本篇内容主要讲解“python开发出现”No module named yum”错误的解决办法”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“python开发出现”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 correctly. It's possible that the above module doesn't match the current version of Python, which is: 2.7.2 (default, Feb 15 2016, 15:15:03) [GCC 4.4.7 20120313 (Red Hat 4.4.7-16)]
yum 错误,搜索一番后知道是yum和Python是依赖关系,yum是python的模块,所以采用以下解决方案:
[root@master1 ~]# python Python 2.7.2 (default, Feb 15 2016, 15:15:03) [GCC 4.4.7 20120313 (Red Hat 4.4.7-16)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
[root@master1 ~]# whereis python python: /usr/bin/python2.6 /usr/bin/python.bak /usr/bin/python /usr/lib/python2.6 /usr/lib64/python2.6 /usr/local/bin/python2.7 /usr/local/bin/python2.7-config /usr/local/bin/python /usr/local/lib/python2.7 /usr/include/python2.6 /usr/share/man/man1/python.1.gz
肯定是yum的版本与当前python的版本不一致造成的
所以修改yum的配置
修改文件: vim /usr/bin/yum
修改头#!/usr/bin/python => #!/usr/bin/python2.6,问题解决
到此,相信大家对“python开发出现”No module named yum”错误的解决办法”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。