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  ]


你可能感兴趣的:(python 升级到2.7.8 导致yum 运行异常:No module named yum)