如何解决yum错误:没有名为CElementTree的模块?

我有以下问题与百胜:

$ 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 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, Feb 22 2012, 16:06:13) [GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] If you cannot solve this problem yourself, please go to the yum faq at: http://wiki.linux.duke.edu/YumFaq 

我的操作系统:CentOS版本5.8(最终版)

当试图从RPM软件包手动安装python-elementtree时,会出现以下错误:

 $ sudo rpm -i http://mirror.centos.org/centos-5/5/os/i386/CentOS/python-elementtree-1.2.6-5.i386.rpm package python-elementtree-1.2.6-7.el4.rf.i386 (which is newer than python-elementtree-1.2.6-5.i386) is already installed $ sudo rpm -i http://mirror.centos.org/centos-5/5/os/i386/CentOS/python-elementtree-1.2.6-5.i386.rpm 

相关链接:

  • http://www.rickrodriguezjr.com/wordpress/archives/183
  • http://www.webhostingtalk.com/showthread.php?t=936132
  • http://www.clearfoundation.com/component/option,com_kunena/Itemid,232/catid,26/func,view/id,45278/
  • http://pingd.org/2012/no-module-named-celementtree-yum-update-error.html
  • http://forums.contribs.org/index.php?topic=49189.0
  • http://www.centos.org/modules/newbb/viewtopic.php?topic_id=3401

嗯,是python-elementtree仍然安装? cEleementTree模块应该位于/usr/lib64/python2.4/site-packages/cElementTree.so usr / lib / …在32位系统上)。 那个文件还存在吗?

如果软件包丢失,您可以使用rpm重新启动它:

x86_64的:

 rpm -i http://mirror.centos.org/centos-5/5/os/x86_64/CentOS/python-elementtree-1.2.6-5.x86_64.rpm 

I386:

 rpm -i http://mirror.centos.org/centos-5/5/os/i386/CentOS/python-elementtree-1.2.6-5.i386.rpm 

尝试手动下载并安装python-elementtree

x86_64的

 wget http://mirrors.usc.edu/pub/linux/distributions/centos/5.8/os/x86_64/CentOS/python-elementtree-1.2.6-5.x86_64.rpm sudo rpm -Uvh python-elementtree-*.rpm 

I386

 wget http://mirrors.usc.edu/pub/linux/distributions/centos/5.8/os/i386/CentOS/python-elementtree-1.2.6-5.i386.rpm sudo rpm -Uvh python-elementtree-*.rpm 

故障排除

错误:'package python-elementtree-1.2.6-7.el4.rf.i386(比python-elementtree-1.2.6-5.i386更新)已经安装'或类似

尝试更换软件包,即使它是通过以下方式安装的:

 sudo rpm -iv --replacepkgs python-elementtree-*.rpm 

要么:

 sudo rpm -iv --replacefiles python-elementtree-*.rpm 

或者最后:

 sudo rpm -iv --force python-elementtree-*.rpm 

请参阅: –replacepkgs:安装包即使已经安装