升级python导致yum命令无法使用
错误信息:
[root@aliyun /]# 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.8 (default, Dec 3 2014, 08:48:50) [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
查看yum版本:
[root@aliyun /]# rpm -qa|grep yum yum-3.2.29-60.el6.centos.noarch yum-metadata-parser-1.1.2-16.el6.x86_64 PackageKit-yum-0.5.8-23.el6.x86_64 yum-plugin-fastestmirror-1.1.30-30.el6.noarch PackageKit-yum-plugin-0.5.8-23.el6.x86_64 yum-utils-1.1.30-30.el6.noarch yum-plugin-security-1.1.30-30.el6.noarch
查看python版本:
[root@aliyun /]# whereis python python: /usr/bin/python /usr/bin/python2.6 /usr/lib/python2.6 /usr/lib64/python2.6 /usr/include/python2.6 /usr/local/python2.7 /usr/share/man/man1/python.1.gz
查找yum文件,并编辑此py文件
[root@aliyun /]# which yum
/usr/bin/yum
再次运行yum,成功运行。
至此,修复成功。