1. cd /usr/src #进入到这个目录
2. wget wget https://www.python.org/ftp/python/3.9.1/Python-3.9.1.tgz #进行安装包的安装
3. tar -xzf Python-3.9.1.tgz #进行解压
4. cd Python-3.9.1 #进入并进行编译安装
5. ./configure
6. yum update -y #如果没有升级过Python就需要安装Python相关的依赖包:
yum install -y make gcc gcc-c++
./configure
7. make #编译
make install #编译和安装
8. python --version #查看版本
Python 2.7.16
9. 如果不是还需要做一下操作
ls -la /usr/bin | grep python
将原来的python软连接进行修改
mv /usr/bin/python /usr/bin/python.bak
修改软连接
ln -s /usr/src/Python-3.9.1/python /usr/bin/python
再次查看版本信息
Python 3.9.1