我刚刚用过yum upgrade yum
,现在不能用了。它一直显示此错误:
[root@devlon5 www]# yum install pdftohtml
epel/primary_db 100% |=========================| 3.8 MB 00:00
epel-erlang 100% |=========================| 2.3 kB 00:00
Traceback (most recent call last):
File "/usr/bin/yum", line 29, in ?
yummain.user_main(sys.argv[1:], exit_code=True)
File "/usr/share/yum-cli/yummain.py", line 254, in user_main
errcode = main(args)
File "/usr/share/yum-cli/yummain.py", line 109, in main
result, resultmsgs = base.doCommands()
File "/usr/share/yum-cli/cli.py", line 353, in doCommands
self._getTs(needTsRemove)
File "/usr/lib/python2.4/site-packages/yum/depsolve.py", line 99, in _getTs
self._getTsInfo(remove_only)
File "/usr/lib/python2.4/site-packages/yum/depsolve.py", line 110, in _getTsInfo
pkgSack = self.pkgSack
File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 774, in <lambda>
pkgSack = property(fget=lambda self: self._getSacks(),
File "/usr/lib/python2.4/site-packages/yum/__init__.py", line 564, in _getSacks
self.repos.populateSack(which=repos)
File "/usr/lib/python2.4/site-packages/yum/repos.py", line 279, in populateSack
sack.populate(repo, mdtype, callback, cacheonly)
File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 164, in populate
if self._check_db_version(repo, mydbtype):
File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 223, in _check_db_version
return repo._check_db_version(mdtype)
File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 1227, in _check_db_version
repoXML = self.repoXML
File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 1417, in <lambda>
repoXML = property(fget=lambda self: self._getRepoXML(),
File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 1409, in _getRepoXML
self._loadRepoXML(text=self)
File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 1399, in _loadRepoXML
return self._groupLoadRepoXML(text, self._mdpolicy2mdtypes())
File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 1375, in _groupLoadRepoXML
self._commonRetrieveDataMD(mdtypes)
File "/usr/lib/python2.4/site-packages/yum/yumRepo.py", line 1348, in _commonRetrieveDataMD
urlgrabber.progress.text_meter_total_size(0)
AttributeError: 'module' object has no attribute 'text_meter_total_size'
是因为它的依赖已经过时了吗?
谁能帮我解决这个问题。太感谢了
答案1
上述错误是由于使用了非常过时的 python-urlgrabber(大约是 RHEL-5 GA)以及比 RHEL-5 中更新版本的 yum 造成的。生皮重建一个?
不过从技术上来说这仍然是一个错误,您可以从 __init__.py 复制代码:
if hasattr(urlgrabber.progress, 'text_meter_total_size'):
urlgrabber.progress.text_meter_total_size(remote_size,
local_size)
答案2
yum 使用 python。所以你应该在升级 yum 之前升级 python。
我不会回滚 yum,而是使用rpm -Uvh
.