1.查看当前Python版本
# python -V Python 2.6.6
2.下载Python2.7.5源码
# wget http://python.org/ftp/python/2.7.5/Python-2.7.5.tgz3.解压源代码包
# tar xvf Python-2.7.5.tgz4.进入解压目录并安装
# cd Python-2.7.5 # ./configure # make all # make install # make clean # make distclean
5.将系统默认的python设置为python2.7.5
# rm /usr/bin/python # ln -s /usr/local/bin/python2.7 /usr/bin/python
6.检查Python版本
# python -V Python 2.7.5
7.解决yum不能运行的问题
因为yum是依赖python2.6.6运行的,所以需要对yum做一些修改
# vim /usr/bin/yum
将第一行的#!/usr/bin/python修改为#!/usr/bin/python2.6