CentOS系統Python升級後yum不可用的解決辦法
阿新 • • 發佈:2018-12-26
通過升級Python後,發現yum命令不能使用了!!!
如何升級Python?詳見
出現如下錯誤:
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, Feb 28 2017, 14:47:53)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)]
If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq
這是因為yum命令是基於Python開發的,當Python升級後,yum命令找不到其所依賴的檔案導致不可用。
如何解決呢?
編輯yum的配置檔案
vi /usr/bin/yum
將檔案首行
#!usr/bin/python
修改為
#!/usr/bin/python2.6.6
儲存退出!
經測試yum可用