1、解压缩到/usr/local/下
tar -xf /opt/Python-3.7.0.tar.xz -C /usr/local/
2、开始升级python
yum install -y epel-release postgresql-devel mariadb-devel openldap-devel gcc-c++ make sshpass libffi-devel
cd /usr/local/Python-3.7.0 && ls
./configure --prefix=/usr/local/python3
make -j 8 #8线程编译,以本机cpu核心数相关
make install
3、创建软连接
cd /usr/bin
ll | grep python
rm -rf python
ln -s /usr/local/python3/bin/python3 ./python
ll | grep python
python -v
4、为pip创建软连接
ln -s /usr/local/python3/bin/pip3 ./pip
pip -V
5、修改yum脚本注释,不然yum用不了
vim /usr/bin/yum 和 /usr/libexec/urlgrabber-ext-down和/usr/bin/yum-config-manager
源注释#! /usr/bin/python 改为 #! /usr/bin/python2.7
测试: yum -y install sl