It's possible that the above module doesn't match the current version of Python

当运行yum时可能出现如下问题:

[root@Centos ~]# yum
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.5.4 (r254:67916, Feb 24 2010, 10:03:49) 
[GCC 4.1.2 20080704 (Red Hat 4.1.2-44)]
If you cannot solve this problem yourself, please go to  请访问http://www.92wiki.com
the yum faq at:
  http://wiki.linux.duke.edu/YumFaq

原因分析: 请访问http://www.92wiki.com

CentOS 5.4系统默认Python版本是2.4.3,需要升级到Python 2.5.4,由于yum包管理是用python写的,仅仅单独升级python会导致yum无法使用.
出现这种情况的主要原因在于新安装的Python没有YUM服务所依赖的Packages.

解决方法: 想知道更多内容:

查找yum文件,并编辑此py文件
[root@Centos ~]# which yum
/usr/bin/yum
[root@Centos ~]# vi /usr/bin/yum
 

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


然后保存OK.

还有一种可能也同样会导致无法使用yum,就是/usr/bin下的python、python2、python2.4三个文件一定不能改变。理论上说yum只是基于python语言,跟版本并没有关系,但是升级过程中确实会出现问题,具体的机制我也不是很清楚。 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值