Python升级Yum不能使用解决
1、系统版本
[root@vm10-254-206-95 ~]# cat /etc/issue
CentOS release 6.4 (Final)
Kernel \r on an \m
2、系统默认python版本
[root@vm10-254-206-95 ~]# python -V
Python 2.6.6
3、报错信息

[root@vm10-254-206-95 ~]# 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.5.4 (r254:67916, Feb 24 2010, 10:03:49) [GCC 4.1.2 20080704 (Red Hat 4.1.2-44)] If you cannot solve this problem yourself, please go to the yum faq at: http://wiki.linux.duke.edu/YumFaq
解决方法:
[root@vm10-254-206-95 ~]# which yum
/usr/bin/yum
[root@vm10-254-206-95 ~]# vi /usr/bin/yum
将
#!/usr/bin/python
改为:
#!/usr/bin/python2.6
然后保存OK.
出处:http://www.cnblogs.com/madsnotes/
声明:本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接。
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步