编译的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.

相关文章

ubuntu退出redis的示例:指定配置文件方式启动源码redis:roo...
ubuntu中mysql改密码忘了的解决方法:1.在终端中切换到root权...
ubuntu安装mysql失败的解决方法原因:可能是原有的MySQL还有...
使用centos和ubuntu建站的区别有以下几点1.CentOS是Linux发行...
ubuntu图形界面和字符界面切换的方法:可以通过快捷键CTRL+A...
ubuntu中重启mysql失败的解决方法1.首先,在ubuntu命令行中,...