yum命令提示There was a problem importing one of the Python modules required to run yum. The error leadin

首先我执行yum命令安装某工具后提示的内容是这样的:

[root@localhost tset]# yum install -y http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   No module named sqlitecachec

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.5 (default, Jun 28 2022, 15:30:04) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]

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

我的系统版本是centos7.9,python版本为:

[root@localhost test]# python --version
Python 2.7.5

网上有说是python版本或环境的问题,有的说用 pip 安装yum(但我的pip命令无法使用),有的说使用yum命令重装python(但我的yum命令无法使用啊)???
询问某AI解决方法,经过了一番尝试后,我的解决方法是这样:

进入 阿里云镜像站 或 CentOS Vault Mirror 下载系统对应版本的:

yum-metadata-parser-xxxxxxxx.rpm
yum-xxxxxxxxx.centos.noarch.rpm
python-setuptools-xxxxxxx.noarch.rpm

你也可以原图下载文件末尾的gif,然后将 .gif 后缀改为 .zip 提取出我准备的文件

或执行以下命令下载

wget https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
wget https://mirrors.aliyun.com/centos/7.9.2009/os/x86_64/Packages/python-setuptools-0.9.8-7.el7.noarch.rpm
# 或
wget https://vault.centos.org/7.9.2009/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget https://vault.centos.org/7.9.2009/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
wget https://vault.centos.org/7.9.2009/os/x86_64/Packages/python-setuptools-0.9.8-7.el7.noarch.rpm

然后依次执行安装命令:

[root@localhost test]# rpm -Uvh --replacepkgs yum-metadata-parser-1.1.4-10.el7.x86_64.rpm 
准备中...                          ################################# [100%]
正在升级/安装...
   1:yum-metadata-parser-1.1.4-10.el7 ################################# [100%]
   
   
[root@localhost test]# rpm -Uvh --replacepkgs yum-3.4.3-168.el7.centos.noarch.rpm python-setuptools-0.9.8-7.el7.noarch.rpm 
准备中...                          ################################# [100%]
正在升级/安装...
   1:python-setuptools-0.9.8-7.el7    ################################# [ 50%]
   2:yum-3.4.3-168.el7.centos         ################################# [100%]

安装完成后查看一下 yum 的版本,确认安装成功

[root@localhost yum]# yum --version
3.4.3
  已安装: rpm-4.11.3-48.el7_9.x86_64 在 2023-08-13 13:03
  构建    :CentOS BuildSystem <http://bugs.centos.org> 在 2021-11-24 16:33
  已提交:Michal Domonkos <mdomonko@redhat.com> ,共 2021-11-01 

  已安装: subscription-manager-1.24.52-1.el7.centos.x86_64 在 2023-08-13 13:40
  构建    :CentOS BuildSystem <http://bugs.centos.org> 在 2023-07-19 12:38
  已提交:Pino Toscano <ptoscano@redhat.com> ,共 2023-06-27 

  已安装: yum-3.4.3-168.el7.centos.noarch 在 2024-11-27 05:10
  构建    :CentOS BuildSystem <http://bugs.centos.org> 在 2020-10-01 17:03
  已提交:CentOS Sources <bugs@centos.org> ,共 2020-09-29 

  已安装: yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch 在 2024-11-23 15:33
  构建    :CentOS BuildSystem <http://bugs.centos.org> 在 2020-05-12 16:27
  已提交:Michal Domonkos <mdomonko@redhat.com> ,共 2020-03-12 

= END =

作者:优秀的老黄

物联沃分享整理
物联沃-IOTWORD物联网 » yum命令提示There was a problem importing one of the Python modules required to run yum. The error leadin

发表回复