2017-11-18 168 views
0

我正在尝试为Python3安装libtorrent。它是一个C++库的包装。但是,我似乎无法让它工作。在Ubuntu上安装libtorrent的Python3绑定

我已经试过:

$ sudo apt-get install python-libtorrent 

$ sudo apt-get install python3-libtorrent 

$ sudo apt-get install libtorrent-rasterbar-dev 

$ sudo apt-get install libtorrent-rasterbar-dev 

PyPi page没有一个下载链接,并因此它似乎并没有被通过PIP安装。有趣的是,它似乎在Python2中工作,但不幸的是,该项目的其余部分是在Python3中。

回答

0

在非Windows系统:

通过运行./configure --enable-python-binding产生的setup.py。

选择您要安装的的

要构建Python绑定做:

运行:

python setup.py build 

以root身份运行:

python setup.py install 

有关详细信息,请参阅:http://www.libtorrent.org/python_binding.html

+0

不幸的是,这并没有为我工作。我仍然得到'ModuleNotFoundError:在python3中没有名为'libtorrent'的模块,现在我在python2中得到'ImportError:/usr/local/lib/python2.7/dist-packages/libtorrent.so:undefined symbol:_ZN10libtorrent20generate_fingerprintENSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEiiii'。我唯一能想到的是'setup.py'是用python2.7编写的,所以我必须使用它而不是python3。也许这样做意味着它试图将它安装到python2而不是3。 – Sam