Linux自带Python2.7更新到Python3.7.2 Python2.7即将完成使命!

2020.1Python将不再支持Python2.7

查看Python版本:

python -V

1将Python源码进行编译并安装Python3.7.2版本(保留老的Python版本)

使用wget命令下载Python:

wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz

2解压缩Python-3.7.2.tgz安装包:

tar -zxvf Python-3.7.2.tgz

3编译安装

cd Python-3.7.2

mkdir /usr/local/python3.7.2

./configure --prefix=/usr/local/python3.7.2

make

make install

3备份python旧版本

mv /usr/bin/python /usr/bin/python2.7_old

4删除旧链接并重新创建链接

rm /usr/bin/python2 

ln -s /usr/bin/python2.7_old /usr/bin/python2

5重新建立Python3.7.2的环境变量

ln -s /usr/local/python3.7.2/bin/python3.7 /usr/bin/python


你可能感兴趣的:(Linux自带Python2.7更新到Python3.7.2 Python2.7即将完成使命!)