No module named yum
升级python之后,执行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.3 (default, Jan 18 2015, 10:32:12)
[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
一般可以通过修改/usr/bin/yum脚本中对python的引用解决。步骤如下:
1、查看当前python版本:
2、查看系统中已安装的python:
3、修改yum脚本
从以上两步骤中得出,之前的python版本应该是2.6,
vi /usr/bin/yum
将#!/usr/bin/python修改为#!/usr/bin/python2.6。再执行yum,恢复正常了。