直接上代码
# 共存就用这个make altinstall,不要用install,
----------
It is critical that you use make altinstall when you install your custom version of Python. If you use the normal make install you will end up with two different versions of Python in the filesystem both named python. This can lead to problems that are very hard to diagnose.
----------
# Python 2.7.14:
wget http://python.org/ftp/python/2.7.14/Python-2.7.14.tar.xz
tar xf Python-2.7.14.tar.xz
cd Python-2.7.14
./configure --prefix=/usr/local --enable-unicode=ucs4 --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
make && make altinstall
# Python 3.6.5:
wget http://python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz
tar xf Python-3.6.5.tar.xz
cd Python-3.6.5
./configure --prefix=/usr/local --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib"
make && make altinstall
#分别为每个python安装各自的pip
wget https://bootstrap.pypa.io/get-pip.py
# Then execute it using Python 2.7 and/or Python 3.6:
python2.7 get-pip.py
python3.6 get-pip.py
本文提供了详细的步骤来安装两个不同版本的Python,并确保它们能够共存而不会产生冲突。通过使用makealtinstall命令来避免文件系统中出现重复的Python版本名称问题。此外,还介绍了如何为每个Python版本分别安装pip。
1444

被折叠的 条评论
为什么被折叠?



