Is Python 2.7 “wide-build” usc4 not compatible with certain libraries?

≯℡__Kan透↙ 提交于 2019-12-05 00:55:25

问题


I required the ability to work with some unicode characters with high values, so I re-installed Python 2.7.10 with option --enable-unicode=ucs4 --prefix ("wide-build").

I then started getting the following error:

...
    from Crypto.Cipher import _ARC4
ImportError: /home/fast/usr/local/lib/python2.7/site-packages/Crypto/Cipher/_ARC4.so: undefined symbol: PyUnicodeUCS2_FromString

I realized that undefined symbol: PyUnicodeUCS2_FromString must be because of the new build, so I then tried reinstalling everything fresh (new Python and new pip and newly installed libraries). I still had the same errors.

Is it simply not possible to use the Crypto library with Python wide-build?

I could not find any documentation on this. Are there any known work-arounds?

Thank you for any help!


回答1:


There is no satisfactory solution for this problem in Python 2: the UCS2 and UCS4 builds have incompatible ABIs, and require libraries to be built from source (as most binary eggs are built against the default UCS2 ABI). This issue details the problem, and the resolution that made it into Python 3.3 (PEP 393).

Your rationale for using a UCS4 build is a little suspect, though. A UCS2 build of Python is perfectly capable of "work[ing] with some unicode characters with high values", using surrogate pairs to represent supplementary code points.



来源:https://stackoverflow.com/questions/31644056/is-python-2-7-wide-build-usc4-not-compatible-with-certain-libraries

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