Hi 你好,欢迎访问!登录
当前位置:首页 - Linux - 正文 君子好学,自强不息!

解决CentOS 6.3 yum ImportError: No module named cElementTree问题

2013-10-29Linux撒加9309°c
A+ A-

今天使用yum check-update的时候,出现了这么一大段错误:

Loaded plugins: fastestmirror
Determining fastest mirrors
epel/metalink                                                                                                                        | 5.3 kB     00:00     
Traceback (most recent call last):
  File "/usr/bin/yum", line 29, in <module>
    yummain.user_main(sys.argv[1:], exit_code=True)
  File "/usr/share/yum-cli/yummain.py", line 285, in user_main
    errcode = main(args)
  File "/usr/share/yum-cli/yummain.py", line 136, in main
    result, resultmsgs = base.doCommands()
  File "/usr/share/yum-cli/cli.py", line 438, in doCommands
    return self.yum_cli_commands[self.basecmd].doCommand(self, self.basecmd, self.extcmds)
  File "/usr/share/yum-cli/yumcommands.py", line 686, in doCommand
    return base.search(extcmds)
  File "/usr/share/yum-cli/cli.py", line 1030, in search
    for (po, keys, matched_value) in matching:
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 2540, in searchGenerator
    for sack in self.pkgSack.sacks.values():
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 897, in <lambda>
    pkgSack = property(fget=lambda self: self._getSacks(),
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 682, in _getSacks
    self.repos.populateSack(which=repos)
  File "/usr/lib/python2.6/site-packages/yum/repos.py", line 265, in populateSack
    self.doSetup()
  File "/usr/lib/python2.6/site-packages/yum/repos.py", line 92, in doSetup
    self.ayum.plugins.run('postreposetup')
  File "/usr/lib/python2.6/site-packages/yum/plugins.py", line 184, in run
    func(conduitcls(self, self.base, conf, **kwargs))
  File "/usr/lib/yum-plugins/fastestmirror.py", line 197, in postreposetup_hook
    if downgrade_ftp and _len_non_ftp(repo.urls) == 1:
  File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 699, in <lambda>
    urls = property(fget=lambda self: self._geturls(),
  File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 696, in _geturls
    self._baseurlSetup()
  File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 642, in _baseurlSetup
    mirrorurls.extend(list(self.metalink_data.urls()))
  File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 739, in <lambda>
    metalink_data = property(fget=lambda self: self._getMetalink(),
  File "/usr/lib/python2.6/site-packages/yum/yumRepo.py", line 726, in _getMetalink
    self._metalink = metalink.MetaLinkRepoMD(result)
  File "/usr/lib/python2.6/site-packages/yum/metalink.py", line 186, in __init__
    root = xmlparse(filename)
  File "/usr/lib/python2.6/site-packages/yum/misc.py", line 1174, in cElementTree_xmlparse
    _cElementTree_import()
  File "/usr/lib/python2.6/site-packages/yum/misc.py", line 1164, in _cElementTree_import
    import cElementTree
ImportError: No module named cElementTree

从google上搜索,说是expat和dbus-python没装,然后用rpm查看了下

[root@zabbixproxy1 ~]# rpm -qa |grep expat
expat-2.0.1-11.el6_2.x86_64
expat-devel-2.0.1-11.el6_2.x86_64
compat-expat1-1.95.8-8.el6.x86_64
[root@zabbixproxy1 ~]# rpm -qa |grep dbus-python
dbus-python-0.83.0-6.1.el6.x86_64

这点玩意都有啊
进入pythen,执行

Type "help", "copyright", "credits" or "license" for more information.
>>> from xml.etree import cElementTree

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.6/xml/etree/cElementTree.py", line 3, in <module>
    from _elementtree import *
ImportError: /usr/lib64/python2.6/lib-dynload/pyexpat.so: symbol XML_SetHashSalt, version EXPAT_2_0_1_RH not defined in file libexpat.so.1 with link time reference
继续报错
后来找到光盘里的expat,通过rpm --force -Uvh expat-2.0.1-11.el6_2.x86_64.rpm重新安装后,一切又归于正常了


  选择打赏方式
微信赞助

打赏

QQ钱包

打赏

支付宝赞助

打赏

  选择分享方式
  移步手机端
解决CentOS 6.3 yum ImportError: No module named cElementTree问题

1、打开你手机的二维码扫描APP
2、扫描左则的二维码
3、点击扫描获得的网址
4、可以在手机端阅读此文章
标签:

发表评论

选填

必填

必填

选填

请拖动滑块解锁
>>


  用户登录