操作系统:CentOS7
安装版本:Python3.8.5
1)查看版本
python -V
Python 2.7.5
将Python2.7.5软链备份
mv /usr/bin/python /usr/bin/python2.7.5
mv /usr/bin/pip /usr/bin/pip2.7.5
python -V
-bash: /usr/bin/python: 没有那个文件或目录
python2.7.5 -V
Python 2.7.5
2)下载Python3.8并且安装
cd /home/install/python
wget https://npm.taobao.org/mirrors/python/3.8.5/Python-3.8.5.tar.xz
tar xvJf Python-3.8.5.tar.xz
cd Python-3.8.5/
./configure --prefix=/usr/local/python3.8.5
make && make install
3)添加软链
ln -s /usr/local/python3.8.5/bin/python3 /usr/bin/python
ln -s /usr/local/python3.8.5/bin/pip3 /usr/bin/pip
python -V
Python 3.8.5
python2.7.5 -V
Python 2.7.5
pip -V
pip 20.1.1 from /usr/local/python3.8.5/lib/python3.8/site-packages/pip (python 3.8)
4)完成,成功安装Python3.8.5,而且Python2.7.5也一同存在,想用Python3.8.5就可以使用python
,想用Python2.7.5就可以使用python2.7.5
,很方便