-bash: /usr/bin/yum: /usr/bin/python2.6.62.6.6: bad interpreter: No such file or directory

-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.




  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值