博主手贱,调了python的软连接和升级了一软件包,改了yum的一些配置文件,导致yum无法使用。
系统环境是centos7
故障信息:
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
pycurl: libcurl link-time ssl backend (nss) is different from compile-time ssl backend (openssl)
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, Oct 14 2020, 14:45:30)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq
故障截图如下:
网上很多方法,博主都尝试过,什么更换yum头,软连接,都没有用,也可能我这边的问题比较复杂,操作过的东西有点多…
后来找到了一个方法就是干掉python和yum重装,测试下来是有效的,下面上代码和记录截图,在这里感谢@洪锌和@DawsonCheng博主的文章
采取实践下来最有效的解决办法,完全删除python及yum,重新进行安装。
rpm -qa|grep python|xargs rpm -ev --allmatches --nodeps
whereis python |xargs rm -frv
rpm -qa|grep yum|xargs rpm -ev --allmatches --nodeps
whereis yum |xargs rm -frv
代码摘要原文链接:https://blog.youkuaiyun.com/qq_43238405/article/details/106479937?spm=1001.2014.3001.5501
下载需要安装的环境包,下载地址:http://mirrors.163.com/centos/7/os/x86_64/Packages/
需要下载的包列表
以centos 7 为例子, 不同的操作版本下载对应不同的包(后缀不同 xxxxxx.el7.x86_64)
python-2.7.5-34.el7.x86_64.rpm
python-chardet-2.2.1-1.el7_1.noarch.rpm
python-devel-2.7.5-34.el7.x86_64.rpm
python-iniparse-0.4-9.el7.noarch.rpm
python-kitchen-1.1.1-5.el7.noarch.rpm
python-libs-2.7.5-34.el7.x86_64.rpm
python-pycurl-7.19.0-17.el7.x86_64.rpm
python-setuptools-0.9.8-4.el7.noarch.rpm
python-urlgrabber-3.10-7.el7.noarch.rpm
rpm-python-4.11.3-17.el7.x86_64.rpm
yum-3.4.3-132.el7.centos.0.1.noarch.rpm
yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
yum-plugin-aliases-1.1.31-34.el7.noarch.rpm
yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm
yum-plugin-protectbase-1.1.31-34.el7.noarch.rpm
yum-updateonboot-1.1.31-34.el7.noarch.rpm
yum-utils-1.1.31-34.el7.noarch.rpm
摘要原文链接:https://blog.youkuaiyun.com/DawsonCheng/article/details/90515869
把这些rpm包上传到服务器的任意某个目录中,在其目录下运行以下代码:
rpm -ivh --force *.rpm --nodeps
问题解决: