![yum 安装损坏](https://linux22.com/image/747619/yum%20%E5%AE%89%E8%A3%85%E6%8D%9F%E5%9D%8F.png)
我尝试使用 yum update 更新我的服务器上的 CentOS,但出现以下错误:
Traceback (most recent call last):
File "/usr/bin/yum", line 4, in <module>
import yum
File "/usr/lib/python2.7/site-packages/yum/__init__.py", line 59, in <module>
import config
File "/usr/lib/python2.7/site-packages/yum/config.py", line 30, in <module>
from parser import ConfigPreProcessor, varReplace
File "/usr/lib/python2.7/site-packages/yum/parser.py", line 4, in <module>
import urlgrabber
File "/usr/lib/python2.7/site-packages/urlgrabber/__init__.py", line 55, in <module>
from grabber import urlgrab, urlopen, urlread
File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 1616
errstr = str(e.args[1]) or pyerr2str.get(errcode, '<Unknown>')
我只能猜测我的 Python 存在一些严重问题。我该如何修复它?
PS 我对基于 Debian 的系统有经验,但对基于 rpm 的系统没有经验。这是我的第一个基于 rpm 的服务器,所以请多多包涵。
编辑:
[root@WEBITCONSULT ~]# yum repolist
Traceback (most recent call last):
File "/usr/bin/yum", line 4, in <module>
import yum
File "/usr/lib/python2.7/site-packages/yum/__init__.py", line 59, in <module>
import config
File "/usr/lib/python2.7/site-packages/yum/config.py", line 30, in <module>
from parser import ConfigPreProcessor, varReplace
File "/usr/lib/python2.7/site-packages/yum/parser.py", line 4, in <module>
import urlgrabber
File "/usr/lib/python2.7/site-packages/urlgrabber/__init__.py", line 55, in <module>
from grabber import urlgrab, urlopen, urlread
File "/usr/lib/python2.7/site-packages/urlgrabber/grabber.py", line 1616
errstr = str(e.args[1]) or pyerr2str.get(errcode, '<Unknown>')
^
SyntaxError: invalid syntax
答案1
请尝试以下操作来清理 yum 缓存和元数据。
yum clean metadata && yum clean all
重建 RPM 数据库。
rm -f /var/lib/rpm/__db*
rpm -vv --rebuilddb
yum repolist
如果你仍然有问题,请在此处输入输出