微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

编译的Python二进制报告版本错误

我试图从源代码编译Python 2.7.这是我的命令:

./configure --prefix=/my/local/dir --exec-prefix=/my/local/dir --enable-shared --with-pydebug
make
make install

并且python的输出是/ my / local / dir / bin / python,这是正确的.

但是当我运行python –version时,我看到的是Python 2.7.3而不是Python 2.7.10.

Python的系统版本是2.7.3.难道是Python的系统版本会以某种方式将自身链接到本地​​编译版本吗?还是我做错了什么?

编辑:

./my/local/dir/bin/python –version的输出也是Python 2.7.3

编辑2:

似乎如果我摆脱了–enable-shared标志,它将生成正确版本的Python,但我需要该标志才能使其他软件正常工作.

解决方法:

因此this post可以解决我的问题.引用源:

If you try to run a –enable-shared python executable from its build directory, you’ll need to tell the dynamic loader where to find the shared library, i.e. the build directory itself. One way to do that is to use the LD_LIBRARY_PATH environment variable. Otherwise, the dynamic loader will search the standard paths, like /usr/local/lib/ and /usr/lib/ for a shared library with the proper name (like libpython2.7.so.1.0). If there is an older Python already installed with that name and if the ABI hasn’t changed too much, you may be lucky and it will load and run.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐