51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

升级Python后No module named yum处理

概述

因项目需求对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
赞(0)
未经允许不得转载:工具盒子 » 升级Python后No module named yum处理