centos升级python导致yum无法使用
来源:互联网 发布:linux安装oracle11g 编辑:程序博客网 时间:2024/05/01 06:58
centos6升级了python的版本,导致yum运行出现No module named yum,而无法使用
原因:
跟yum匹配的python版本是系统带的2.6版本,而现在python版本被更新到2.7
其他用到python的软件也可能会出现这种问题,处理方法一样:如下解决方法
现象:
[root@localhost ~]# yum install http-devel -y
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.12 (default, Jan 10 2017, 10:36:02)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-16)]
If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq
解决办法:
检查之前的版本python2.6是否存在:
[root@localhost ~]# ll /usr/bin/python*
lrwxrwxrwx 1 root root 24 Jan 10 10:36 /usr/bin/python -> /usr/local/bin/python2.7
lrwxrwxrwx. 1 root root 6 Aug 25 21:29 /usr/bin/python2 -> python
-rwxr-xr-x 1 root root 9032 Jul 24 2015 /usr/bin/python2.6
修改yum启动脚本:
vim /usr/bin/yum
把第一行的#!/usr/bin/python
修改为:
#!/usr/bin/python2.6
检查是否可以使用:
[root@localhost ~]# yum list
Loaded plugins: fastestmirror, security
Loading mirror speeds from cached hostfile
另外一种方法,网上找的,未测试,供参考:
首先找到你安装Centos的光盘或者ISO文件,拷贝如下文件到系统中:
(或者找一个yum源,下载以下包也可以,只要系统版本一样即可,例如:http://mirrors.ustc.edu.cn/centos/)
python-2.6.6-36.el6.x86_64.rpm
python-urlgrabber-3.9.1-8.el6.noarch.rpm
python-devel-2.6.6-36.el6.x86_64.rpm
python-libs-2.6.6-36.el6.x86_64.rpm
yum-3.2.29-40.el6.centos.noarch.rpm
具体版本号,根据你系统盘或者ISO提供为准。我是拷贝到了如下目录
/usr/local/rpm/Python-2.6.6
执行安装
cd /usr/local/rpm/Python-2.6.6/
rpm -Uvh --replacepkgs *.rpm
python-2.6.6-36.el6.x86_64.rpm
python-urlgrabber-3.9.1-8.el6.noarch.rpm
python-devel-2.6.6-36.el6.x86_64.rpm
python-libs-2.6.6-36.el6.x86_64.rpm
yum-3.2.29-40.el6.centos.noarch.rpm
具体版本号,根据你系统盘或者ISO提供为准。我是拷贝到了如下目录
/usr/local/rpm/Python-2.6.6
执行安装
cd /usr/local/rpm/Python-2.6.6/
rpm -Uvh --replacepkgs *.rpm
0 0
- centos升级python导致yum无法使用
- centos中python升级导致yum命令无法使用
- linux Python升级导致Yum无法使用
- python升级导致yum命令无法使用的解决办法
- python升级导致yum命令无法使用的解决办法
- python升级导致yum命令无法使用的解决办法
- Python升级或降级导致yum命令无法使用
- centos6下升级python导致yum无法使用的解决办法
- CentOS中python升级之后yum无法使用的问题
- Python升级导致使用yum报错
- 升级Python而导致的YUM服务无法使用的修复方法
- python升级导致yum命令无法使用的解决办法(修改版)
- python升级导致yum命令无法使用的解决办法(修改版)
- python升级后yum无法使用
- centos下,将python升级3.0+以上版本后,yum、update等无法使用问题
- python 升级导致yum失败
- virtualbox 升级到4.3.20导致centos 5.3无法使用
- CentOS无法使用YUM
- c++ 函数指针使用实例
- subsystem request failed on channel 0 Couldn't read packet: Connection reset by peer
- 网易2017内推笔试编程题(合集)
- 优先队列--二叉堆实现
- Java集合的概述
- centos升级python导致yum无法使用
- 如何使用strace+pstack利器分析程序性能
- 上传开源库到JCenter
- golang的命名规范及大小写的访问权限
- 无锁的对象引用:AtomicReference(转)
- Jquery中each的三种遍历方法
- 访问者模式使用反射
- 关于jQuery选择器的空格问题
- boost如何序列化 和反序列化 指针类(本身类也可以)