-bash: /usr/bin/yum: /usr/bin/python2.6.62.6.6: bad interpreter: No such file or directory
错误很简单 找不到python2.6.62.6.6文件夹,原因是安装其他软件导致python版本和yum配置里到pyhon版本不一致,所以yum找不到pyhon执行文件。
解决方法:进入到 /usr/bin 文件夹下 看看当前的python执行文件名 然后把/usr/bin/yum 首行改为相应文件名
[root@host bin]# cd /usr/bin
[root@host bin]# ls -al | grep python
lrwxrwxrwx 1 root root 24 Oct 12 10:05 python -> /usr/local/bin/python2.7
lrwxrwxrwx 1 root root 6 Oct 12 09:57 python2 -> python
-rwxr-xr-x 1 root root 4864 Aug 18 2016 python2.6
lrwxrwxrwx 1 root root 24 Oct 12 10:00 python2.6.6 -> /usr/local/bin/python2.7
vi /usr/bin/yum 后改如下首行
#!/usr/bin/python2.6.6
import sys
try:
import yum
except ImportError:
print >> sys.stderr, """\
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
%s
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:
%s
If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq
然而 ,还不可以,输入yum 显示倒入 一个python模块出错,原因是当前yum 的python执行版本太高。上面看到我还有2.6的python版本。因此将 /usr/bin/yum py文件的首行改成低版本的pyhon(2.6)即可
[root@host bin]# 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.