今天在測試服務器用yum的時候報錯了: html
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:python
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.6 (default, Sep 29 2018, 18:12:27)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-18)]服務器
If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faqpython2.7
這是由於升級python後, 沒有指定yum用系統自帶python版本致使的. yum和Python有依賴關係,yum是python的模塊. ide
[root@centos-A ~]# python -V # 果真是有人升級版本了, centos 6.9 默認是2.6的 Python 2.7.6 [root@centos-A ~]# which python /usr/local/bin/python [root@centos-A ~]# ll /usr/local/bin/python lrwxrwxrwx 1 root root 7 Sep 29 18:13 /usr/local/bin/python -> python2 [root@centos-A ~]# ll /usr/local/bin/python2 lrwxrwxrwx 1 root root 9 Sep 29 18:13 /usr/local/bin/python2 -> python2.7 [root@centos-A ~]# which python2.6 /usr/bin/python2.6 [root@centos-A ~]# [root@centos-A ~]# vim /usr/bin/yum ###修改這個文件, 把第一行 #!/usr/bin/python 改成 #!/usr/bin/python2.6 #!/usr/bin/python2.6
看這樣就行了, 升級Python以前也寫過, 能夠參考一下測試
http://www.javashuo.com/article/p-hpxlopio-ew.htmlui