概述

由于前同事升级Python版本至2.7.9导致原有的系统默认版本python异常,无法使用yum正常的功能。

[root@localhost ~]# yum update
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   cannot import name urandom

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.6.6 (r266:84292, Apr 11 2011, 15:50:32) 
[GCC 4.4.4 20100726 (Red Hat 4.4.4-13)]

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

处理办法

卸载原有python
[root@localhost ~]# rpm -e python-2.6.6-20.el6.x86_64 --nodeps
[root@localhost ~]# rpm -e python-devel-2.6.6-20.el6.x86_64 --nodeps
[root@localhost ~]# rpm -e python-libs-2.6.6-20.el6.x86_64 --nodeps
安装最新python
[root@localhost ~]# rpm -ivh http://file.lolicp.com/Mirrors/Centos/6/Packages/python-devel-2.6.6-66.el6_8.x86_64.rpm --nodeps
[root@localhost ~]# rpm -ivh http://file.lolicp.com/Mirrors/Centos/6/Packages/python-libs-2.6.6-66.el6_8.x86_64.rpm --nodeps
[root@localhost ~]# rpm -ivh http://file.lolicp.com/Mirrors/Centos/6/Packages/python-2.6.6-66.el6_8.x86_64.rpm --nodeps
END

本文标题:Centos6 Yum: cannot import name urandom故障处理

本文作者:宇宙最帅的男人

本文链接:https://lolicp.com/linux/202112325.html

版权声明:转载或者引用本文内容请注明来源及原作者,本文著作权归 (lolicp.com) 所有。

除非另有说明,本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议

最后修改:2024 年 10 月 13 日
如果觉得我的文章对你有用,请随意赞赏