Python 升级导致 yum 命令无法使用的解决办法


报错信息如下

[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:  
  
  
   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.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

执行命令 找到yum命令的在哪

[root@iZ6249dycmaZ ~]# whereis yum
yum: /usr/bin/yum /etc/yum /etc/yum.conf /usr/share/man/man8/yum.8.gz

编辑命令

vim /usr/bin/yum
#!/usr/bin/python
改成
#!/usr/bin/python2.6.6

yum配置.jpg

重命名命令

cp /usr/bin/python /usr/bin/python2.6.6
分享:

评论