yum中的python版本錯誤

一、報錯信息以下:html

[root@develop local]# yum -y install prce
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
python

   No module named yumlinux

Please install a package which provides this module, or
verify that the module is installed correctly.
centos

It's possible that the above module doesn't match the
current version of Python, which is:
2.6.1 (r261:67515, Aug 7 2010, 11:36:17) 

[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)]ide

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

錯誤緣由:錯誤信息描述爲 yum 所依賴的python 不相符,請安裝相對應python便可this

二、執行yum查看信息spa

[root@develop bin]# yum
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
orm

   No module named yumhtm

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.6.1 (r261:67515, Aug 7 2010, 11:36:17) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)]

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

提示當前版本是2.6.1可能版本不匹配。沒有yum依賴的包。

三、查看yum版本

[root@develop local]# rpm -qa |grep yum
yum-3.2.8-9.el5.centos.1
yum-metadata-parser-1.1.2-2.el5

四、查看python版本

[root@develop local]# whereis python
python: /usr/bin/python2.4 /usr/bin/python /usr/lib/python2.4 /usr/local/bin/python2.6 /usr/local/bin/python2.6-config /usr/local/bin/python /usr/local/lib/python2.6 /usr/share/man/man1/python.1.gz

果真裝了兩個版本python

五、執行python,查看到使用2.6.1的版本

[root@develop local]# python
Python 2.6.1 (r261:67515, Aug 7 2010, 11:36:17) 

[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

六、猜想yum調用了高版本的python。

七、解決方法:

查找yum文件,並編輯此py文件
[root@develop local]# which yum
/usr/bin/yum
[root@develop local]# vi /usr/bin/yum


#!/usr/bin/python
改成:
#!/usr/bin/python2.4

而後保存OK.

補充:yum基於python寫的。


轉自:http://blog.sina.com.cn/s/blog_62c8f3c901012s5c.html

相關文章
相關標籤/搜索