linux no module named yum,No module named yum解决办法

(1)错误提示:

[root@gflinux4 ~]# yum -y install kernel-debuginfo-common-2.6.18-238.el5

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.8 (default, Oct 31 2014, 09:32:25)

[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)]

If you cannot solve this problem yourself, please go to

the yum faq at:

(2)解决办法

yum是python的一个模块,在安装python时会自动安装后。

python 的位置:

[root@gflinux4 ~]# python

Python 2.7.8 (default, Oct 31 2014, 09:32:25)

[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> exit

Use exit() or Ctrl-D (i.e. EOF) to exit

>>>

[root@gflinux4 ~]# whereis python

python: /usr/bin/python /usr/lib/python2.4 /usr/include/python2.4 /usr/local/python /usr/share/man/man1/python.1.gz

查看python的安装路径

[root@gflinux4 ~]# cd /usr/local/python/bin/

[root@gflinux4 bin]# ll

total 4488

-rwxr-xr-x 1 root root     108 Oct 31 09:33 2to3

-rwxr-xr-x 1 root root     314 Nov  3 10:26 easy_install

-rwxr-xr-x 1 root root     322 Nov  3 10:26 easy_install-2.7

-rwxr-xr-x 1 root root     106 Oct 31 09:33 idle

-rwxr-xr-x 1 root root      91 Oct 31 09:33 pydoc

lrwxrwxrwx 1 root root       7 Oct 31 09:34 python -> python2

lrwxrwxrwx 1 root root       9 Oct 31 09:34 python2 -> python2.7

-rwxr-xr-x 1 root root 4535058 Oct 31 09:33 python2.7

-rwxr-xr-x 1 root root    1681 Oct 31 09:34 python2.7-config

lrwxrwxrwx 1 root root      16 Oct 31 09:34 python2-config -> python2.7-config

lrwxrwxrwx 1 root root      14 Oct 31 09:34 python-config -> python2-config

-rwxr-xr-x 1 root root   18554 Oct 31 09:33 smtpd.py

修改/usr/bin/yum文件的头信息如下:

[root@gflinux4 bin]# vi /usr/bin/yum

#!/usr/bin/python => #!/usr/bin/python2

import sys

try:

再次运行如下:

[root@gflinux4 ~]# yum

/usr/bin/python: can't open file '=> #!/usr/bin/python2': [Errno 2] No such file or directory

OK测试成功。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值