首页
学习
活动
专区
圈层
工具
发布
社区首页 >专栏 >Python升级导致yum命令不能使用

Python升级导致yum命令不能使用

作者头像
py3study
发布于 2020-01-09 16:54:03
发布于 2020-01-09 16:54:03
1.8K0
举报
文章被收录于专栏:python3python3

错误信息如下:

[root@bjzw-mcu01-x86p-app01 ~]# yum -y update 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, Jul  8 2014, 22:55:29) [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)]

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

排错思路:

1.查看yum的版本号

[root@bjzw-mcu01-x86p-app01 ~]# rpm -qa | grep yum yum-3.2.29-60.el6.centos.noarch yum-plugin-fastestmirror-1.1.30-30.el6.noarch yum-utils-1.1.30-30.el6.noarch yum-plugin-security-1.1.30-30.el6.noarch yum-metadata-parser-1.1.2-16.el6.x86_64

2.查看python的版本号,发现有2种版本号

[root@bjzw-mcu01-x86p-app01 ~]# whereis python python: /usr/bin/python2.6 /usr/bin/python /usr/lib/python2.6 /usr/lib64/python2.6 /usr/include/python2.6 /usr/local/python2.7 /usr/share/man/man1/python.1.gz

3. 查看当前所使用的版本

[root@bjzw-mcu01-x86p-app01 ~]# python Python 2.7.3 (default, Jul  8 2014, 22:55:29) [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2 Type "help", "copyright", "credits" or "license" for more information.

4.修改yum命令所使用的python版本号

[root@bjzw-mcu01-x86p-app01 ~]# vim /usr/bin/yum

#!/usr/bin/python2.6

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019/08/27 ,如有侵权请联系 cloudcommunity@tencent.com 删除
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档