1、当前系统python版本
[root@localhost ~]# python -V
Python 2.7.5
2、下载所需python版本
[root@localhost ~]# wget https://www.python.org/ftp/python/3.9.9/Python-3.9.9.tgz
3、解压
[root@localhost ~]# tar -xf Python-3.9.9.tgz -C /usr/local/
4、编译并安装 (编译时如果报错就是缺少某些依赖,直接yum安装就可以)
[root@localhost ~]# cd /usr/local/Python-3.9.9/
[root@localhost Python-3.9.9]# ls
[root@localhost Python-3.9.9]# ./configure
[root@localhost Python-3.9.9]# make && make install
5、完成后,现在系统中有两个版本的python
[root@localhost Python-3.9.9]# python -V
Python 2.7.5
[root@localhost Python-3.9.9]# python3 -V
Python 3.9.9
6、查看python命令
[root@localhost Python-3.9.9]# ll /usr/bin/ |grep python
-rwxr-xr-x. 1 root root 11312 Nov 14 2018 abrt-action-analyze-python
lrwxrwxrwx 1 root root