錯誤信息以下:python
[root@bjzw-mcu01-x86p-app01 ~]# yum -y update
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:linux
No module named yumvim
Please install a package which provides this module, or
verify that the module is installed correctly.centos
It's possible that the above module doesn't match the
current version of Python, which is:
2.7.3 (default, Jul 8 2014, 22:55:29)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)]app
If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faqpython2.7
排錯思路:ide
1.查看yum的版本號ui
[root@bjzw-mcu01-x86p-app01 ~]# 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_64this
2.查看python的版本號,發現有2種版本號url
[root@bjzw-mcu01-x86p-app01 ~]# 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. 查看當前所使用的版本
[root@bjzw-mcu01-x86p-app01 ~]# python
Python 2.7.3 (default, Jul 8 2014, 22:55:29)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
4.修改yum命令所使用的python版本號
[root@bjzw-mcu01-x86p-app01 ~]# vim /usr/bin/yum
#!/usr/bin/python2.6