从源代码构建python时,必须指定一个前缀,用于标识要安装到的目录:
./configure --prefix="/etc/py27/"
make
sudo make altinstall
我们现在在/ etc / py27 /
中安装了python现在,忽略我们在启动脚本中管理的环境变量,让我们说我们不想再次从源代码构建,并希望重新定位Python运行时文件。 / p>
我注意到/etc/py27
路径的硬编码如下:
[/etc/py27mv]$ grep -iRI '/etc/py27' *
bin/python2.7-config:#!/etc/py27/bin/python2.7
bin/pydoc:#!/etc/py27/bin/python2.7
bin/smtpd.py:#!/etc/py27/bin/python2.7
bin/2to3:#!/etc/py27/bin/python2.7
bin/idle:#!/etc/py27/bin/python2.7
lib/python2.7/config/Makefile:prefix= /etc/py27
lib/python2.7/config/Makefile:CONFIG_ARGS= '--prefix=/etc/py27/'
lib/python2.7/_sysconfigdata.py: 'BINDIR': '/etc/py27/bin',
lib/python2.7/_sysconfigdata.py: 'BINLIBDEST': '/etc/py27/lib/python2.7',
lib/python2.7/_sysconfigdata.py: 'CONFIG_ARGS': "'--prefix=/etc/py27/'",
lib/python2.7/_sysconfigdata.py: 'CONFINCLUDEDIR': '/etc/py27/include',
lib/python2.7/_sysconfigdata.py: 'CONFINCLUDEPY': '/etc/py27/include/python2.7',
lib/python2.7/_sysconfigdata.py: 'DESTDIRS': '/etc/py27 /etc/py27/lib /etc/py27/lib/python2.7 /etc/py27/lib/python2.7/lib-dynload',
lib/python2.7/_sysconfigdata.py: 'DESTLIB': '/etc/py27/lib/python2.7',
lib/python2.7/_sysconfigdata.py: 'DESTSHARED': '/etc/py27/lib/python2.7/lib-dynload',
lib/python2.7/_sysconfigdata.py: 'INCLDIRSTOMAKE': '/etc/py27/include /etc/py27/include /etc/py27/include/python2.7 /etc/py27/include/python2.7',
lib/python2.7/_sysconfigdata.py: 'INCLUDEDIR': '/etc/py27/include',
lib/python2.7/_sysconfigdata.py: 'INCLUDEPY': '/etc/py27/include/python2.7',
lib/python2.7/_sysconfigdata.py: 'LIBDEST': '/etc/py27/lib/python2.7',
lib/python2.7/_sysconfigdata.py: 'LIBDIR': '/etc/py27/lib',
lib/python2.7/_sysconfigdata.py: 'LIBP': '/etc/py27/lib/python2.7',
lib/python2.7/_sysconfigdata.py: 'LIBPC': '/etc/py27/lib/pkgconfig',
lib/python2.7/_sysconfigdata.py: 'LIBPL': '/etc/py27/lib/python2.7/config',
lib/python2.7/_sysconfigdata.py: 'MACHDESTLIB': '/etc/py27/lib/python2.7',
lib/python2.7/_sysconfigdata.py: 'MANDIR': '/etc/py27/share/man',
lib/python2.7/_sysconfigdata.py: 'SCRIPTDIR': '/etc/py27/lib',
lib/python2.7/_sysconfigdata.py: 'datarootdir': '/etc/py27/share',
lib/python2.7/_sysconfigdata.py: 'exec_prefix': '/etc/py27',
lib/python2.7/_sysconfigdata.py: 'prefix': '/etc/py27',
lib/pkgconfig/python-2.7.pc:prefix=/etc/py27
如果这些/etc/py27
引用中的每一个都替换为这些文件的新位置,我们是否有效地移动了python运行时?在二进制文件中是否还有其他参考文献可能需要从源代码构建作为唯一选项?