Do the python bindings for libtorrent-rasterbar work with Python 3 ?

ぃ、小莉子 提交于 2019-12-24 02:02:43

问题


I have Python 3.4 (32-bit) installed, and I installed the python-libtorrent-0.16.16.win32.msi on top of that.

My test code says: ImportError: DLL load failed: %1 is not a valid Win32 application.

My google results suggest this works fine with Python 2.7. Is that the solution? I have to down-grade my Python?


回答1:


NO. Libtorrent doesn't support Python 3.

It compiles but doesn't work due to Python 3 utf8 handling difference. There was an unsuccessful effort to make it work a while back https://code.google.com/p/libtorrent/issues/detail?id=449

Current trunk even contains invalid Python 3 i.e. http://sourceforge.net/p/libtorrent/code/HEAD/tree/trunk/bindings/python/setup.py Line 70 > 'print cmdline'

For some reason there is an Ubuntu python3-libtorrent package which confuses people, but it definitely doesn't work, neither does manual compilation.

steps:
apt-get build-dep libtorrent-rasterbar
export 'PYTHON_VERSION=3.4'; export 'PYTHON=/usr/bin/python3.34'
./configure LDFLAGS="-L/usr/lib/python3.4/config-3.4m-x86_64-linux-gnu/" --enable-python-binding --enable-geoip=no
--with-boost-python=boost_python-py34
ldconfig

>> python
import libtorrent
ses = libtorrent.session()
ses.save_state()

"UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa2 in position 0: invalid start byte"


来源:https://stackoverflow.com/questions/24073609/do-the-python-bindings-for-libtorrent-rasterbar-work-with-python-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!