yum update后出错,提示引用的python模块有问题,以为是yum软件损坏了,差一点就重新安装yum服务。
使用rpm -qa|grep yum指令查看,原有的yum服务还在
yum-3.2.29-69.el6.centos.noarch
yum-plugin-fastestmirror-1.1.30-30.el6.noarch
yum-metadata-parser-1.1.2-16.el6.x86_64
仔细一瞧,原来是python版本升级导致的问题
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.10 (default, Aug 23 2016, 18:47:04)
[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服务版本由2.6升级到了2.7,使用whereis python指令可以看到有两个版本的python服务
python: /usr/bin/python2.7-config /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
lrwxrwxrwx 1 root root 18 8月 23 2016 /usr/bin/python -> /usr/bin/python2.7
知道问题所在,解决方案也就有了
1.编辑/usr/bin/yum文件
将/usr/bin/yum开头的
#!/usr/bin/python
替换顾
#!/usr/bin/python2.6
注意此处替换为你系统原有的python版本
2.重新建立系统python软链接
rm /usr/bin/python
ln -s /usr/bin/python2.6 /usr/bin/python
评论已关闭!