yum指令之修复

时间:2021-09-12 23:32:05

折腾着搞 openvpn 网站服务器 yum指令 出了点问题

------------------------------------------------------------

[root@cloud ~]# yum
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.6.6 (r266:84292, Feb 22 2013, 00:00:18)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)]

-----------------------------------------------------------

原因:

根据报错信息提示,yum 会用到 Python 的某些模块。当前模块安装错误 或者 Python 版本错误

当前错误是 Python 版本错误

解决:

1. 查看yum版本 rpm -qa |grep yum

查看python版本 whereis python

发现 python果然安装了两个版本2.6和2.7版本

2. 编辑 yum 使用的 python 版本

vi /usr/bin/yum

把#!/usr/bin/python改为#!/usr/bin/python2.6