1.下载Pyhon,选择下载Gzipped source tar ball (2.7.6) (sig)
wget https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tar.xz --no-check-certificate
2.解压安装,命令如下
xz -d Python-2.7.13.tar.xz
tar xvf Python-2.7.13.tar
cd Python-2.7.6
./configure --prefix=/usr/local/python2.7
make
make install
3.创建链接来使系统默认python变为python2.7
ln -fs /usr/local/python2.7/bin/python2.7 /usr/bin/python
4.查看Python版本
python –V
5.修改yum配置(否则yum无法正常运行)
vi /usr/bin/yum
将第一行的#!/usr/bin/python修改为系统原有的python版本地址#!/usr/bin/python2.6
至此CentOS6.3系统Python已成功升级至2.7.6版本
转载于:https://blog.51cto.com/9393764/1956385