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 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, Jul 16 2014, 08:48:25)

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

If you cannot solve this problem yourself, please go to

the yum faq at:

http://wiki.linux.duke.edu/YumFaq

[[email protected] ~]# rpm -qa |grep yum

yum-security-1.1.16-21.el5

yum-updatesd-0.9-2.el5

yum-metadata-parser-1.1.2-3.el5

yum-3.2.22-39.0.2.el5

yum-rhn-plugin-0.5.4-26.0.1.el5

[[email protected] ~]# whereis python

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

[[email protected] ~]# which yum

/usr/bin/yum

[[email protected] ~]# vi /usr/bin/yum

#!/usr/bin/python2.4   ----这一行需要修改为 /usr/bin/python2.4

import sys

try:

。。。。

"/usr/bin/yum" 32L, 806C written

-----再次运行yum 正常运行

[[email protected] ~]# yum install list

Loaded plugins: rhnplugin, security

This system is not registered with ULN.

ULN support will be disabled.

file:///media/oel/Server/repodata/repomd.xml: [Errno 5] OSError: [Errno 2] No such file or directory: ‘/media/oel/Server/repodata/repomd.xml‘

Trying other mirror.

Setting up Install Process

No package list available.

---- 同时也更新下/usr/sbin/yum-updatesd

[[email protected] etc]# vi /usr/sbin/yum-updatesd

#!/usr/bin/python2.4 -tt

---重启服务

[[email protected] etc]# service yum-updatesd restart

Stopping yum-updatesd: [FAILED]

Starting yum-updatesd: [  OK  ]

时间: 2024-10-25 13:15:18

python 升级到2.7.8 导致yum 运行异常:No module named yum的相关文章

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

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 

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

[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升级Python2.6到3.7,错误处理[No module named ‘_ctyp

CentOS6升级Python2.6到3.7,错误处理[No module named '_ctypes'] 因开发需要,在CentOS 6 服务器将Python2进行升级到Python3.由于工作中内网的限制,这里使用的是手动安装的方式进行. 一.查看当前python版本 [[email protected] ~]$ python -V Python 2.6.6 二.官网下载Python稳定版本(当前3.7.2)进行安装 这里下载软件使用python用户,安装使用root用户进行 # 下载步骤

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

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

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 # 输出为