No module named yum

升级python之后,执行yum的时候可能出现错误,类似:

There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

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.3 (default, Jan 18 2015, 10:32:12)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)]

If you cannot solve this problem yourself, please go to
the yum faq at:
  http://yum.baseurl.org/wiki/Faq

一般可以通过修改/usr/bin/yum脚本中对python的引用解决。步骤如下:

1、查看当前python版本:

2、查看系统中已安装的python:

3、修改yum脚本

从以上两步骤中得出,之前的python版本应该是2.6,

vi /usr/bin/yum

将#!/usr/bin/python修改为#!/usr/bin/python2.6。再执行yum,恢复正常了。

时间: 2024-10-12 20:23:58

No module named yum的相关文章

No module named yum错误的解决办法

今天用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 c

python升级导致yum不可用 “ No module named yum”

最近在看python,虚拟机装的是Centos6.6,自带的python版本是2.6.6,打算升级到2.7. 我的升级过程大致如下: 下载2.7源码包https://www.python.org/downloads/source/ 卸载旧的python,rpm -e python 编译安装python2.7 整个过程没有遇到问题,但升级完后,再用yum安装软件时报如下错误 [[email protected] python]# yum There was a problem importing 

python 升级到2.7.8 导致yum 运行异常:No module named yum

os version: [[email protected] etc]# cat redhat-release Red Hat Enterprise Linux Server release 5.4 (Tikanga) ---运行yum 报错 [[email protected] ~]# yum install dialog There was a problem importing one of the Python modules required to run yum. The error

CentOS6.5 安装Python2.7后, yum出现“No module named yum”错误

安装如下方法安装python2.7: yum install –y python27 python27-devel Python-docutils cd /usr/bin/ rm -rf python cp python2.7 python   出现yum错误:No module named yum 解决方法,查看 /usr/bin下python有哪几个版本 ll /usr/bin 我这里是:2.6  和  2.7 (刚安装的) 由于yum命令不兼容python2.7,需修改/usr/bin/y

No module named yum解决办法

(1)错误提示: [[email protected] ~]# 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 whi

import yum\r\nImportError: No module named yum

报错:FAILED! => {"changed": false, "module_stderr": "Shared connection to 192.168.10.10 closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n File \"/tmp/ansible_NDuf1p/ansible_module_yum

[linux]centos7 升级python后出现“No module named yum”错误

公司服务器重新安装系统后,手动升级python2.7.5到2.7.15,安装完python在更新系统python版本的过程中无意删除了系统自带的版本,导致后来在执行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 p

CentOS6.5运行yum报错:No module named yum

公司测试机环境不知道给我卸了什么包,导致yum运行报错状况: 报错情况: There was a problem importing one of the Python modulesrequired to run yum. The error leading to this problem was: No module named sqlite Please install a package which provides this module, orverify that the modu

Linux—运行yum报错:No module named yum

产生原因:yum基于python写的,根据报错信息提示,是yum的python版本对应不上目前python环境的版本导致的.也就是说 有人升级或者卸载了python. 解决方式: # 查看yum版本 [[email protected] ~]# rpm -qa | grep yum # 查看python版本 [[email protected] ~]# whereis python # 查找yum文件,并编辑此py文件 [[email protected] ~]# which yum # 输出为