前往 下载最新版的python
下载好后解压编译安装:
yum install zlib zlib-devel openssl openssl-devel
tar -zxvf Python-XXXXXX.tgz
cd Python-XXXXXX.tgz
./configure
make && make install
ln -sf /usr/local/bin/python3 /usr/bin/python
mv /usr/bin/pip /usr/bin/pip.bak
ln -s /usr/local/bin/pip3 /usr/bin/pip
升级后yum运行会报错,需要修改两个地方:
vi /usr/bin/yum
vi /usr/libexec/urlgrabber-ext-down
将这两个第一行的:#!/usr/bin/python 替换成#!/usr/bin/python2
安装 pip:
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
ln -s /usr/local/bin/pip3 /usr/bin/pip