升级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 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,恢复正常了。

No module named yum的更多相关文章

  1. No module named yum错误的解决办法

    今天用yum安装软件的时候出现如下错误: There was a problem importing one of the Python modules required to run yum. Th ...

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

  3. yum源使用的几个报错小总结 (例如: python2.6.6 下yum不能使用: No module named yum)

    服务器上的yum突然不好使用,使用yum时有如下几个保持,解决方案如下: 1)Error: Cannot retrieve repository metadata (repomd.xml) for r ...

  4. centos6.8 安装Python2.7后, yum出现“No module named yum”错误

    出现yum错误:No module named yum 解决方法,查看 /usr/bin下python有哪几个版本 ll /usr/bin 我这里是:2.6  和  2.7 (刚安装的) 由于yum命 ...

  5. centos yum出现no module named yum

    运行yum出现如下错误 There was a problem importing one of the Python modules required to run yum. The error l ...

  6. ImportError: No module named yum

    [root@localhost]# yum-complete-transactionTraceback (most recent call last):  File "/usr/sbin/y ...

  7. python2.6升级2.7导致yum无法使用 No module named yum

    这里有解决方法:https://teddysun.com/473.html 记住旧版本 Python 2.6.6 的重要路径如下所示,在运行 yum 命令的时候,会提示你哪个 module 不存在,不 ...

  8. linux No module named yum错误的解决办法

    linux No module named yum错误的解决办法 肯定是yum的版本与当前python的版本不一致造成的 <pre>所以修改yum的配置,修改文件: vim /usr/bi ...

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

    产生原因:yum基于python写的,根据报错信息提示,是yum的python版本对应不上目前python环境的版本导致的.也就是说 有人升级或者卸载了python. 解决方式: # 查看yum版本 ...

随机推荐

  1. java关于Timer schedule执行定时任务 !!!!!!!!!

    1.在应用开发中,经常需要一些周期性的操作,比如每5分钟执行某一操作等.对于这样的操作最方便.高效的实现方式就是使用java.util.Timer工具类. private java.util.Time ...

  2. Cannot call sendRedirect() after the response has been committed错误;

    Cannot call sendRedirect() after the response has been committed提示信息其实很清楚,如果response已经提交过了,就无法再发送sen ...

  3. JAVA源码之JDK(三)——String、StringBuffer、StrinBuilder

    Java中,除了8种基本类型,最长用的应该就是String类了.那么我们来看看JDK中的源码是怎么建造String.StringBuffer.StrinBuilder一系列类的. java.lang. ...

  4. About Outlook Rule Quota

    在Exchange中默认有设置outlook的规则的大小,如果client在outlook上设定的规则超过大小会导致功能无法使用 Outlook的郵件規則,在Exchange 2000/2003時,郵 ...

  5. git 学习(一)初始化和提交

    git 学习(一) 创建git版本库 $ mkdir gitstudy $ cd gitstudy $ git init nitialized empty Git repository in /Use ...

  6. mysql delete 多表

    DELETE u.*,acu.*,alu.* FROM user u, accountuser acu ,algouser alu WHERE u.userId=11 and acu.userID=1 ...

  7. mysql 客户端命令行下 直接查询并导出数据

    mysql原来还能这么导出数据,涨知识了. 方式1: select ....(sql语句) INTO OUTFILE   '/var/lib/mysql/msg_data.csv ' (导出的文件位置 ...

  8. django中的setting全局变量的导入

    需求:在py文件中导入settings.py中的变量BASE_DIR settings.py文件 import os # Build paths inside the project like thi ...

  9. Java集合类学习记录

    被标记为transient的属性在对象被序列化的时候不会被保存int[] arr1 = {1, 2, 3, 4, 5}; int[] arr2 = Arrays.copyOf(arr1, new_le ...

  10. Linux学习笔记(5)磁盘分区(parted)

    Linux学习笔记(5)磁盘分区(parted) .演示: ()parted /dev/sdb :进入parted 分区命令(可以使用help来查看命令详细描述)(2)p :列出当前磁盘分区信息,可以 ...