我正在尝试使用 torrentp 在 python 中下载 torrent,但它依赖于libtorrent
.
我尝试运行这段代码:
import asyncio
from torrentp import TorrentDownloader
torrent_file = TorrentDownloader("magnet:...", '.')
# Start the download process
asyncio.run(torrent_file.start_download()) # start_download() is a asynchronous method
但我收到这个错误:
D:\Torrent\Media\Script>python torrent.py
Traceback (most recent call last):
File "D:\Torrent\Media\Script\torrent.py", line 2, in <module>
from torrentp import TorrentDownloader
File "C:\Users\XXX\AppData\Local\Programs\Python\Python310\lib\site-packages\torrentp\__init__.py", line 6, in <module>
from .torrent_downloader import TorrentDownloader
File "C:\Users\XXX\AppData\Local\Programs\Python\Python310\lib\site-packages\torrentp\torrent_downloader.py", line 4, in <module>
import libtorrent as lt
ImportError: DLL load failed while importing libtorrent: The specified module could not be found.
我读过几篇相关文章libtorrent
,但到目前为止还没有解决这个问题:
- 重新安装 Microsoft Visual C++ Redistributable
- 重新安装
libtorrent
并torrentp
我使用安装了 libtorrent pip install libtorrent
,并且pip install torrentp
还尝试从以下位置安装软件包github并做
python setup.py build
和
python setup.py install
但我得到这个:
error: [WinError 2] The system cannot find the file specified
都来自build
和install
。