解决CentOS 6.4下升级Python为2.7.X导致yum不能使用的问题

话说CentOS 6.4自带的Python版本是有点老了,2.6.6,我通过下载源码编译安装的方式升级到了2.7.9,不过弄好后,发现yum不好使了,提示以下错误:

required to run yum. The error leading to this problem was:

   No module named yum

Please install a package which provides this module, or  
verify that the module is installed correctly.

It's possible that the above module doesn't match the  
current version of Python, which is:  
2.7.9 (default, Feb  4 2015, 00:48:59)  
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)]

If you cannot solve this problem yourself, please go to  
the yum faq at:  
  http://yum.baseurl.org/wiki/Faq

从错误上看应该就是Python的版本问题导致的。

vi /usr/bin/yum编辑yum文件,将#!/usr/bin/python修改为#!/usr/bin/python2.6.6就可以愉快的安装软件了。