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.9 (default, Aug 21 2024, 14:17:12)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)]
If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq
背景:我在原来的python版本上升级了2.7.9后,yum就不能用了,我vim /usr/bin/yum 后,修改了新的python路径(#!/usr/local/bin/python),依然不好用。
处理:查看/usr/bin/目录下
# cd /usr/bin/
ll | grep python
11232 Aug 10 2017 abrt-action-analyze-python
153 Aug 19 14:11 ipython
153 Aug 19 14:11 ipython2
7280 Apr 13 2018 pmpython
21 Aug 21 14:20 python -> /usr/local/bin/python # 有问题
9 Jun 21 2021 python2 -> python2.7
7216 Apr 11 2018 python2.7
7 Jun 21 2021 python2.7.5 -> python2
1835 Apr 11 2018 python2.7-config
16 Jun 21 2021 python2-config -> python2.7-config
14 Jun 21 2021 python-config -> python2-config
操作如下:
rm -f python
ln -s python2 python
ll | grep python
11232 Aug 10 2017 abrt-action-analyze-python
153 Aug 19 14:11 ipython
153 Aug 19 14:11 ipython2
7280 Apr 13 2018 pmpython
7 Aug 21 14:49 python -> python2
9 Jun 21 2021 python2 -> python2.7
7216 Apr 11 2018 python2.7
7 Jun 21 2021 python2.7.5 -> python2
1835 Apr 11 2018 python2.7-config
16 Jun 21 2021 python2-config -> python2.7-config
14 Jun 21 2021 python-config -> python2-config
然后 ,yum命令就可以使用了
本站资源均来自互联网,仅供研究学习,禁止违法使用和商用,产生法律纠纷本站概不负责!如果侵犯了您的权益请与我们联系!
转载请注明出处: 免费源码网-免费的源码资源网站 » 解决No module named yum There was a problem importing one of the Python modules
发表评论 取消回复