安装 运行yum报错:No module named 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 sqlite

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:

一、升级或卸载Python导致:

1
2
3
4
5
6
7
8
1、查看已安装python的版本,可能是当前系统存在多个python导致
[root@test ~]# whereis python
python: /usr/bin/python2.6 /usr/bin/python /usr/bin/python2.6-config /usr/lib/python2.6 /usr/lib64/python2.6 /usr/include/python2.6 /usr/share/man/man1/python.1.gz
[root@test ~]# vi /usr/bin/yum
将 #!/usr/bin/python 修改为 #!/usr/bin/python2.6
如果是源代码安装的,默认路径是/usr/local/bin/python2.6,做个软链接即可
rm -rf /usr/bin/python
ln -s /usr/local/bin/python2.6 /usr/bin/python
原文地址:https://www.cnblogs.com/zgaspnet/p/7699724.html