yum命令无法执行、运行错误
在一次进行VNCSERVER的远程调试过程,发现Centos的提示有100多个升级包需要升级,直接点后,就发现yum出现了问题,无法运行
[root@nl etc]#yum -y update
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
No module named cElementTree
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.4.3 (#1, Sep 3 2009, 15:37:12)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)]
If you cannot solve this problem yourself, please go to
the yum faq at: http://wiki.linux.duke.edu/YumFaq
以上错误内容如果为import yum ImportError: No module named yum 则是因为python的版本不正确造成的。请看跟帖http://free.yes81.net/yes81/view-11292.html
解决方法
下载一个centos5.6版本的支持包
http://rpm.pbone.net/index.php3/stat/4/idpl/15700378/dir/centos_5/com/python-elementtree-1.2.6-5.i386.rpm.html (RPM Search CentOS 5 python-elementtree-1.2.6-5.i386.rpm 版本要根据自己OS选择正确才会有效 附件下载:python-elementtree-1.2.6-5.i386.rar)并放置在下面/usr/local/src/rpm
目录里。跟着安装这个包之后问题就理解解决了
#cd /usr/local/src/rpm
#rpm -ivh --force python-elementtree*
一切正常。
跟着直接:
#yum update #升级操作
---------------------------------------------------
#!/bin/bash
packages=`yum list installed | grep python | awk '{print $1}'`
yum reinstall $packages
-----------------------------------------------------
上面内容编辑成批处理语法,直接运行他,全部给yum python升级上
但是升级后,就是执行了YUM的全部升级,结果导致错误的。同样上面内容执行后,一样会问题又出来。要解决问题,又必须重新执行上面单独修复组件的修复语法。
看来系统在这里这里有个BUG(系统默认会去升级RedLinux E4 内核的升级包1.2.6-7.el4.rf)晕死!