Is Python 2.7 “wide-build” usc4 not compatible wit

2019-03-31 01:43发布

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条回答
三岁会撩人
2楼-- · 2019-03-31 01:58

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.

查看更多
登录 后发表回答