python 升級到2.7.8 導致yum 運行異常:No module named yum,2.7.8yum

來源:互聯網
上載者:User

python 升級到2.7.8 導致yum 運行異常:No module named yum,2.7.8yum

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  ]


相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.