概述
由于系统被前同事升级过python,导致python依赖有问题致使yum不可用。
[root@localhost ~]# yum list wget
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
/usr/lib64/python2.7/site-packages/rpm/_rpm.so: undefined symbol: rpmpkgVerifySigs
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.7.5 (default, Feb 11 2014, 07:46:25)
\[GCC 4.8.2 20140120 (Red Hat 4.8.2-13)\]
`If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq`
解决办法
查询rpm-python
版本信息,并进行卸载
[root@localhost ~]# rpm -q rpm-python
rpm-python-4.11.1-16.el7.x86_64
[root@localhost ~]# rpm -e rpm-python --nodeps
下载并安装与原版本一致的rpm包
[root@localhost ~]# wget https://buildlogs.centos.org/c7.00.03/rpm/20140609184502/4.11.1-16.el7.x86_64/rpm-python-4.11.1-16.el7.x86_64.rpm --no-check-certificate
[root@localhost ~]# rpm -ivh rpm-python-4.11.1-16.el7.x86_64.rpm
准备中... ################################# [100%]
正在升级/安装...
1:rpm-python-4.11.1-16.el7 ################################# [100%]
[root@localhost ~]# yum clean all
其他解决
如上述操作过程无法解决问题,可尝试重新安装
rpm -Uvh rpm-libs-xxxxxx.rpm --nodeps
rpm -Uvh rpm-xxxxxx.rpm --nodeps
rpm -Uvh rpm-build-xxxxxx.rpm --nodeps
rpm -Uvh rpm-python-xxxxxx.rpm --nodeps
rpm -Uvh rpm-sign-xxxxxx.rpm --nodeps
验证
[root@localhost ~]# yum list wget
已加载插件:fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
Determining fastest mirrors
已安装的软件包
wget.x86_64 1.14-10.el7 @anaconda/7.0
可安装的软件包
wget.x86_64 1.14-15.el7_4.1 base