Python 下载的地址:https://www.python.org/downloads/source/
Python的升级:
[root@centos soft]# tar zxvf Python-3.9.1.tgz
[root@centos soft]# cd Python-3.9.1
[root@centos Python-3.9.1]# ./configure
[root@centos Python-3.9.1]# make && make install
默认安装路径
[root@centos Python-3.9.1]# ll /usr/local/bin/python*
lrwxrwxrwx 1 root root 9 Jan 6 10:05 /usr/local/bin/python3 -> python3.9
-rwxr-xr-x 1 root root 14113100 Jan 6 10:05 /usr/local/bin/python3.9
-rwxr-xr-x 1 root root 3078 Jan 6 10:05 /usr/local/bin/python3.9-config
lrwxrwxrwx 1 root root 16 Jan 6 10:05 /usr/local/bin/python3-config -> python3.9-config
旧版本Python安装位置
[root@centos Python-3.9.1]# ll /usr/bin/python*
-rwxr-xr-x 2 root root 9032 Jan 22 2014 /usr/bin/python
lrwxrwxrwx. 1 root root 6 Jun 10 2014 /usr/bin/python2 -> python
-rwxr-xr-x 2 root root 9032 Jan 22 2014 /usr/bin/python2.6
备份旧版本Python
mv /usr/bin/python /usr/bin/python.bak
为新版本Python创建软连接
ln -s /usr/local/bin/python3.9 /usr/bin/python
查看Python
[root@centos /]# python -V
Python 3.9.1