yum 无法使用

[root@zabbix yum.repos.d]# yum 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.2 (default, Apr 11 2016, 10:35:40) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)]

If you cannot solve this problem yourself, please go to 
the yum faq at:
  http://yum.baseurl.org/wiki/Faq
  

YUM 是基于python 写的,错误是由于yum 调用了高版本的PYTHON
查看yum版本

[root@zabbix yum.repos.d]# rpm -qa |grep yum
yum-3.2.29-69.el6.centos.noarch
yum-metadata-parser-1.1.2-16.el6.x86_64
yum-3.2.29-40.el6.centos.noarch
yum-plugin-fastestmirror-1.1.30-30.el6.noarch
yum-plugin-fastestmirror-1.1.30-14.el6.noarch

 

查看python版本

[root@zabbix yum.repos.d]# whereis python
python: /usr/bin/python /usr/bin/python2.6 /usr/bin/python2.6-config /usr/bin/python2.7 /usr/lib/python2.6 /usr/lib64/python2.6 /usr/include/python2.6 /usr/share/man/man1/python.1.gz

 有2.6与2.7两个版本

#which yum

/usr/bin/yum

#vim /usr/bin/yum

   #!/usr/bin/python2.6

保存关闭

#yum update 

此时可以正常使用

 

posted on 2016-04-21 14:21  旋风百草  阅读(987)  评论(0编辑  收藏  举报