1. 查看当前系统python的版本
python -V
2. 下载python软件包
cd /usr/local/src
wget http://python.org/ftp/python/2.7.9/Python-2.7.9.tgz
3. 解压并安装
tar zxf Python-2.7.9.tgz cd Python-2.7.9 ./configure make all make install
4. 建立软链接
mv /usr/bin/python /usr/bin/python2.6.6
ln -s /usr/local/bin/python2.7 /usr/bin/python
5. 由于系统默认yum调用python2.6版本,因此需重新安装python2.6.6
6. 执行安装python2.6.6
cd /usr/local/src/Python-2.6.6
rpm -Uvh --replacepkgs *.rpm
7. 重新建立链接
rm -rf /usr/bin/python
ln -s /usr/local/bin/python2.7 /usr/bin/python
8. 修改yum配置文件/usr/bin/yum
将#!/usr/bin/python 修改成 #!/usr/bin/python2.6.6
9. 完成以上步骤后,即可正常使用yum和python