Python Windows 中的 Libtorrent 导入错误

问题描述 投票:0回答:1

我正在尝试使用 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 的文章,但到目前为止还没有解决这个问题:

  1. 重新安装 Microsoft Visual C++ Redistributable
  2. 重新安装 libtorrent 和 torrentp

我使用

pip install libtorrent
pip install torrentp
安装了 libtorrent 我还尝试从 github 安装软件包并执行 python setup.py build 和 python setup.py install 但我得到了这个:

error: [WinError 2] The system cannot find the file specified

来自构建和安装

python windows torrent libtorrent
1个回答
0
投票

我建议在 Github 上检查此软件包:Torrent-To-Google-Drive-Downloader

© www.soinside.com 2019 - 2024. All rights reserved.