我正在尝试将libtorrent添加到Python中。我的问题是,尽管我已经尝试了很多(尽管有些奇怪)的解决方法(稍后将对此进行更多的讨论),但我还是无法在我的生命中导入模块。在
我将回顾我所做的一切。我偶然发现了一些“解决方案”,它们在一定程度上帮助了我,但并不是一路帮助了我。我甚至试着听从造物主在Stack Overflow上提供的指示。在
让我们后退几步,看看我做了些什么。我们将从boost开始。如果您不知道,libtorrent需要boost才能正常工作。当我的知识得到提升时,我的知识并不丰富,因此我将不作解释。所以,就像我遵循的所有指令一样,都说需要提升。我立即安装了boost并将其路径添加到环境表中。我随后运行了boost中提供的bat文件,它创建了两个文件(可能更多)B2.exe和BJAM。B2是我在接下来的步骤中需要使用的。在
我继续进入下载的boost文件夹(1.66版)>;tools>;build>;example,然后编辑用户-配置堵塞添加以下项目:
using msvc : 14.0 ;
using gcc : : : -std=c++11 ;
using python : 3.6 : C:\Users\XXXX\AppData\Local\Programs\Python\Python36-32 : C:\Users\XXXX\AppData\Local\Programs\Python\Python36-32\include : C:\Users\XXXX\AppData\Local\Programs\Python\Python36-32\libs ;
然后,我为VS2017打开一个提升的x64原生工具命令提示符,并执行以下命令
b2.exe --hash openssl-version=pre1.1 link=shared libtorrent-link=shared stage_module stage_dependencies
同样由Arvid(我相信创建者)在libtorrent>;bindings>;python文件夹中提供 这开始了5分钟的下载期。它给了我以下信息:
Performing configuration checks
- 32-bit : yes (cached)
- arm : no (cached)
- mips1 : no (cached)
- power : no (cached)
- sparc : no (cached)
- x86 : yes (cached)
- symlinks supported : yes (cached)
...patience...
...patience...
...patience...
...found 7252 targets...
...updating 27 targets...
最后说
^{pr2}$指令基本上就停在这里了,所以您会认为它现在配置正确了。不是。我立即转到bindings>;python文件夹,果然存在libtorrent.pyd文件以及libtorrent.lib文件夹。 看上去很有前途。我启动了一个命令提示符,检查了Pip(Pip list)并在列表中看到了libtorrent。进入python并尝试导入libtorrent。在
Python 3.6.5 (v3.6.5:f59c0932b4, Mar 28 2018, 16:07:46) [MSC v.1900 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import libtorrent
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: DLL load failed: The specified module could not be found.
pyd文件存在,所以我尝试手动将其拖动到python DLL文件夹中,仍然无法导入。我甚至做了一本手册
sys.path.append('D:\Downloads\libtorrent-rasterbar-1.1.7\libtorrent-
rasterbar-1.1.7\bindings\python')
一些人建议这样做,因为它可能没有联系。在
我不知所措。在
我无法导入它,但它显然不仅存在于pip列表中,而且存在于libtorrent>;bindings>;python文件夹中(pyd和lib文件)。在
我也试过运行设置.py文件也一样。它也做了同样的事情,但不能让我更进一步。在
我做了一个观察:libtorrent>;bindings>;python>;bin文件夹中的文件夹有一个奇怪的名称:“D796976F6D1133697DAC2430151009”包含一个src文件夹,libtorrent.exp文件, libtorrent.lib, libtorrent.pdb版, libtorrent.pyd文件, libtorrent.pyd.manifest文件以及libtorrent.pyd.rsp在
在我看来,安装或下载没有完全完成。可能不是这样,只是一个没有受过教育的猜测。而且libtorrent.lib文件位于libtorrent>;bindings>;python文件夹中,并且libtorrent.pyd文件文件大小分别为2 KB和3000 KB
它可能被破坏了吗?我没有正确地连接它吗?在
我使用的是32位的python3.6.5(也有64位的,但由于某些原因根本无法与libtorrent一起使用)。安装了Windows 10的基于Windows的64位系统。提升1.66.0。尝试下载/安装/导入libtorrent-rasterbar-1.1.7
目前没有回答
相关问题 更多 >
编程相关推荐