概述

因项目需求对Python版本进行升级,但升级完成后yum不可用。

[root@localhost ~]# yum list
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
 
   No module named yum
 
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.9 (default, Jul 20 2021, 14:26:53)
[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

解决办法

查看python版本
[root@localhost yum.repos.d]# rpm -q python
python-2.6.6-36.el6.x86_64
卸载对应包
[root@localhost yum.repos.d]# rpm -e python-2.6.6-36.el6.x86_64 --nodeps
安装原先版本包

如无安装包则需使用搜索引擎检索对应安装包名称进行下载,key为版本+.rpm

rpm -ivh python-2.6.6-36.el6.x86_64.rpm
END

本文标题:升级Python后No module named yum处理

本文作者:宇宙最帅的男人

本文链接:https://lolicp.com/linux/202115201.html

版权声明:转载或者引用本文内容请注明来源及原作者,本文著作权归作者 (宇宙最帅的男人) 所有。

除非另有说明,本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议

最后修改:2021 年 09 月 15 日
如果觉得我的文章对你有用,请随意赞赏