Python升级导致yum命令不能使用
错误信息如下:# yum -y update
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, Jul8 2014, 22:55:29)
If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq
排错思路:
1.查看yum的版本号
# rpm -qa | grep yum
yum-3.2.29-60.el6.centos.noarch
yum-plugin-fastestmirror-1.1.30-30.el6.noarch
yum-utils-1.1.30-30.el6.noarch
yum-plugin-security-1.1.30-30.el6.noarch
yum-metadata-parser-1.1.2-16.el6.x86_64
2.查看python的版本号,发现有2种版本号
# whereis python
python: /usr/bin/python2.6 /usr/bin/python /usr/lib/python2.6 /usr/lib64/python2.6 /usr/include/python2.6 /usr/local/python2.7 /usr/share/man/man1/python.1.gz
3. 查看当前所使用的版本
# python
Python 2.7.3 (default, Jul8 2014, 22:55:29)
on linux2
Type "help", "copyright", "credits" or "license" for more information.
4.修改yum命令所使用的python版本号
# vim /usr/bin/yum
#!/usr/bin/python2.6
不错,学习了!
页:
[1]