有一台服务器,准备使用yum安装一个软件包,结果报错,yum list,yum clean,都不能正常使用;
查找了很多资料,说是python版本的问题,结果查看也没有发现问题;
错误如下:
# yum list
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 298, in user_main
errcode = main(args)
File "/usr/share/yum-cli/yummain.py", line 110, in main
base = cli.YumBaseCli()
File "/usr/share/yum-cli/cli.py", line 72, in __init__
output.YumOutput.__init__(self)
File "/usr/share/yum-cli/output.py", line 307, in __init__
self.reported_error_msgs = dict((k, False) for (k, v) in ERRORS_TO_KBASE_ARTICLES.iteritems())
NameError: global name 'ERRORS_TO_KBASE_ARTICLES' is not defined
查看yum命令第一行
[root@host ~]# cat /usr/bin/yum
#!/usr/bin/python
查看python版本2.6.6
[root@host ~]# python -V
Python 2.6.6
解决方法:
下载yum资源 rpm包地址:http://rpmfind.net/linux/rpm2html/search.php?query=yum
重新下载了一个yum的rpm包,重新升级安装即可;
# rpm -ivh yum-3.2.29-75.el6.centos.noarch.rpm