centos6 修复 yum 的 No module named yum 问题

使用yum提示 以下错误:

There was a problem importing one of the Python modules
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.13 (default, Dec 28 2016, 23:33:42)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)]

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

liaozhiwei@CentOS release 6.7 (Final)(120.24.45.74):~$ /usr/bin/yum -v
There was a problem importing one of the Python modules
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.13 (default, Dec 28 2016, 23:33:42)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)]

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

解决方法:

sudo vim /usr/bin/yum

将第一行的 #!/usr/bin/python 改成 #!/usr/bin/python26,保存即可