![](/img/trans.png)
[英]How can I replace a Python 2.65 UCS-2 build with one built using UCS-4 without losing everything in my site-packages?
[英]How do I build Python 2.7 with unicode UCS-2 support
我发现自己处于支持需要 python 2.7 的旧应用程序的不幸位置。 我拉下最新的 2.7 版本( wget https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tgz
)并安装它,但现在我得到了可怕的“未定义符号: PyUnicodeUCS2_AsUTF8String" 来自应用程序中的一个软件包的错误。
好的,所以退出并运行:
./configure --enable-shared --enable-unicode=ucs2
make install
python -c "import sys; print('ucs2' if sys.maxunicode == 65535 else 'ucs4')"
但我仍然得到ucs4
的答案。 查看 Makefile 配置参数已通过:
# configure script arguments
CONFIG_ARGS= '--enable-shared' '--enable-unicode=ucs2'
我错过了什么? 如何在我的 python 构建中获得 UCS-2 支持? 在 amazonlinux:2018.03 docker 容器中运行它,我没有看到任何其他 python 安装。
好的,不肯定 python 对链接库做了什么,但是在烦躁了好几个小时之后,似乎设置 LD_LIBRARY_PATH 会得到我想要的。 IE:
> ./configure --enable-shared --enable-unicode=ucs2 --prefix=/fubar/python
...
> make install
...
> export PATH=/fubar/python/bin:$PATH
> python -c "import sys; print('ucs2' if sys.maxunicode == 65535 else 'ucs4')"
ucs4
> export LD_LIBRARY_PATH=/fubar/python/lib:$LD_LIBRARY_PATH
> python -c "import sys; print('ucs2' if sys.maxunicode == 65535 else 'ucs4')"
ucs2
所有这些工作的方式可能有一些明显的东西,但我很长一段时间不必担心设置 LD_LIBRARY_PATH ......
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.