python 升级到2.7.8 导致yum 运行异常:No module named yum

os version:

[root@lixora etc]# cat redhat-release
Red Hat Enterprise Linux Server release 5.4 (Tikanga)


---运行yum 报错

[root@lixora ~]# yum install dialog

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.8 (default, Jul 16 2014, 08:48:25) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-52)]


If you cannot solve this problem yourself, please go to 
the yum faq at:
  http://wiki.linux.duke.edu/YumFaq
  


[root@lixora ~]# rpm -qa |grep yum
yum-security-1.1.16-21.el5
yum-updatesd-0.9-2.el5
yum-metadata-parser-1.1.2-3.el5
yum-3.2.22-39.0.2.el5

yum-rhn-plugin-0.5.4-26.0.1.el5


[root@lixora ~]# whereis python
python: /usr/bin/python2.4 /usr/bin/python /usr/lib/python2.4 /usr/include/python2.4 /usr/share/man/man1/python.1.gz
[root@lixora ~]# which yum 

/usr/bin/yum



[root@lixora ~]# vi /usr/bin/yum
# !/usr/bin/python2.4   ----这一行需要修改为 /usr/bin/python2.4 
import sys
try:
。。。。

"/usr/bin/yum" 32L, 806C written


-----再次运行yum 正常运行

[root@lixora ~]# yum install list
Loaded plugins: rhnplugin, security
This system is not registered with ULN.
ULN support will be disabled.
file:///media/oel/Server/repodata/repomd.xml: [Errno 5] OSError: [Errno 2] No such file or directory: '/media/oel/Server/repodata/repomd.xml'
Trying other mirror.
Setting up Install Process

No package list available.




---- 同时也更新下/usr/sbin/yum-updatesd

[root@lixora etc]# vi /usr/sbin/yum-updatesd
#!/usr/bin/python2.4 -tt


---重启服务

[root@lixora etc]# service yum-updatesd restart
Stopping yum-updatesd: [FAILED]
Starting yum-updatesd: [  OK  ]


  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值