如何解决找不到 libtorrent 模块
我使用此代码从 torrent 下载到使用 google colab 的驱动器
1 !apt install python3-libtorrent
2
3 import libtorrent as lt
4
5 ses = lt.session()
6 ses.listen_on(6881,6891)
7 downloads = []
ModuleNotFoundError: No module named 'libtorrent'
完整的输出是
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)
<ipython-input-2-1098f0f9d9d1> in <module>()
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 匹配的发行版
输出是
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)
<ipython-input-1-b9ec203eb952> in <module>()
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,click the
"Open Examples" button below.
---------------------------------------------------------------------------
解决方法
请按照以下给定的 YouTube 链接进行操作。这对你有帮助。
总之,只需在“!apt install python3-libtorrent”前添加以下两行
!python -m pip install --upgrade pip setuptools wheel
!python -m pip install lbry-libtorrent
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。