首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >未找到libtorrent模块

未找到libtorrent模块
EN

Stack Overflow用户
提问于 2021-02-25 16:26:38
回答 1查看 3.8K关注 0票数 2

我使用此代码通过google colab从torrent下载到驱动器

代码语言:javascript
运行
复制
1   !apt install python3-libtorrent
2
3   import libtorrent as lt
4 
5   ses = lt.session()
6   ses.listen_on(6881, 6891)
7   downloads = []

它在第3行运行了一个错误,内容是:

代码语言:javascript
运行
复制
ModuleNotFoundError: No module named 'libtorrent'

完整的输出是

代码语言:javascript
运行
复制
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3-libtorrent is already the newest version (1.1.5-1build1).
0 upgraded, 0 newly installed, 0 to remove and 13 not upgraded.
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
 in ()
      1 get_ipython().system('apt install python3-libtorrent')
      2 
----> 3 import libtorrent as lt
      4 
      5 ses = lt.session()

ModuleNotFoundError: No module named 'libtorrent'

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------

我尝试使用pip而不是apt,但不起作用。另一个错误是:

找不到满足python3-libtorrent要求的版本(来自版本:无)未找到与python3-libtorrent匹配的发行版本

输出是

代码语言:javascript
运行
复制
ERROR: Could not find a version that satisfies the requirement python3-libtorrent (from versions: none)
ERROR: No matching distribution found for python3-libtorrent
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
 in ()
      1 get_ipython().system('pip install python3-libtorrent')
      2 
----> 3 import libtorrent as lt
      4 
      5 ses = lt.session()

ModuleNotFoundError: No module named 'libtorrent'

---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.

To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-02-25 17:31:06

请点击下面给出的YouTube链接。这将对您有所帮助。

https://youtu.be/kFG2YHVGZLs

简而言之,只需在"!apt install python3-libtorrent“之前添加以下两行即可。

!python -m pip安装--升级pip setuptools轮

!python -m pip安装lbry-libtorrent

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/66364850

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档