./configure --enable-shared 在 python altinstall 期间到底做了什么? [英] What exactly does ./configure --enable-shared do during python altinstall?
问题描述
当我使用 altinstall python 2.7.12
When I altinstall python 2.7.12 with
./configure --prefix=/opt/python --enable-shared
./configure --prefix=/opt/python --enable-shared
它出现为 python 2.7.5(系统默认 python)
it comes up as python 2.7.5 (system default python)
但是没有
--启用共享
它显示为 2.7.12,我错过了什么?
it comes up as 2.7.12, what am I missing?
这是在 RHEL 7.2 上
This is on RHEL 7.2
这不是路径问题:
没有--enable-shared
Without --enable-shared
[root@myrig ~]#/opt/python/bin/python2.7 -V
[root@myrig ~]# /opt/python/bin/python2.7 -V
Python 2.7.12
Python 2.7.12
使用 --enable-shared
With --enable-shared
[root@myrig ~]#/opt/python/bin/python2.7 -V
[root@myrig ~]# /opt/python/bin/python2.7 -V
Python 2.7.5
Python 2.7.5
推荐答案
像这样编译 python 解决了我的问题:
Compiling python like this fixed my issue:
./configure --enable-shared --prefix=/opt/python LDFLAGS=-Wl,-rpath=/opt/python/lib
由内德·迪利提供:
问题是,在大多数 Unix 系统上(Mac OS X 除外),共享库的路径不是绝对路径.因此,如果您在非标准位置安装 Python,这样做是正确的,以免干扰相同版本的系统 Python,您将需要在共享库的路径中进行配置或通过运行时的环境变量,如 LD_LIBRARY_PATH.你最好避免 --enable-shared;使用它很容易遇到这样的问题.
The problem is, that on most Unix systems (with the notable exception of Mac OS X), the path to shared libraries is not an absolute path. So, if you install Python in a non-standard location, which is the right thing to do so as not to interfere with a system Python of the same version, you will need to configure in the path to the shared library or supply it via an environment variable at run time, like LD_LIBRARY_PATH. You may be better off avoiding --enable-shared; it's easy to run into problems like this with it.
参考:https://bugs.python.org/issue27685
这篇关于./configure --enable-shared 在 python altinstall 期间到底做了什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!