毋意,毋必,毋固,毋我分享 http://blog.sciencenet.cn/u/zgggyh1984

博文

PYTHON升级导致yum命令无法使用的解决方案

已有 22503 次阅读 2010-5-18 12:38 |个人分类:未分类|系统分类:科研笔记| Yum

CentOS 5.4系统默认Python版本是2.4.3
需要升级到Python 2.5.4,由于yum包管理是用python写的,仅仅单独升级python会导致yum无法使用.
出现这种情况的主要原因在于新安装的Python没有YUM服务所依赖的Packages.
 
[root@TC-Boss ~]# 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 
the yum faq at:
  http://wiki.linux.duke.edu/YumFaq
 
解决方法:
查找yum文件,并编辑此py文件
[root@TC-Boss ~]# which yum
/usr/bin/yum
[root@TC-Boss ~]# vi /usr/bin/yum
 

#!/usr/bin/python
改为:
#!/usr/bin/python2.4
 
然后保存OK.

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

https://blog.sciencenet.cn/blog-400120-325780.html

上一篇:在dell电脑上安centos5.4心得
下一篇:centos5.4下meep配置
收藏 IP: .*| 热度|

1 金小伟

发表评论 评论 (1 个评论)

数据加载中...
扫一扫,分享此博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-5-14 04:08

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部