centos 升级python

1.下载python3.6.1的包

wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz

2.解压

tar -zxvf Python-3.6.1.tgz

进入Python-3.6.1目录  输入./configure

make

make install

*** 此时报错:zipimport.ZipImportError: can't decompress data; zlib not available

*** 解决问题:yum install zlib zlib-devel -y

*** 其他方法(未验证):https://github.com/pyenv/pyenv/wiki/Common-build-problems

3.修改系统默认的版本

python --version 还是2.7.5

mv /usr/bin/python /usr/bin/python27

ln -s /usr/local/bin/python3.6 /usr/bin/python

原文地址:https://www.cnblogs.com/huaizhi/p/8806406.html