Fedora: NO module named RPM when using YUM

我与影子孤独终老i 提交于 2019-12-11 16:45:10

问题


I removed numpy and scipy contents from the system's Python 2.6.4 in order to install different versions for them and now I broke YUM. The error I get is the following:

There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   No module named rpm

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.4 (r264:75706, Jun  4 2010, 18:20:31) 
    [GCC 4.4.4 20100503 (Red Hat 4.4.4-2)]

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

Also when I import YUM from inside the python console I get the following error:

Traceback (most recent call last): 
File "<stdin>", line 1, in <module>   
File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 23, in <module>

import rpm ImportError:

 No module named rpm

Python is working fine and I managed to install numpy however I want to install scipy using YUM and I can't. Also when I run:

rpm --version

I get: RPM version 4.8.1.

Is there a way to solve this issue? I would be grateful for any advice or pointers towards solving this issue.


回答1:


It looks like you don't have rpm-python installed. If yum was previously working, then it is difficult to see how the rpm module is not installed. Take a look in /usr/lib/python2.6/site-packages/rpm - that directory should exist, and should contain a couple of python files (__init__.py and transaction.py) and a shared library for rpm.

If the /usr/lib/python2.6/site-packages/rpm directory or the files are missing then you could try to install it. First check whether it is in the RPM database using rpm -q rpm-python. If it not installed then you can get the rpm from somewhere like this mirror and install it (rpm -ivh http://mirror.as24220.net/pub/fedora/linux/releases/20/Fedora/i386/os/Packages/r/rpm-python-4.11.1-7.fc20.i686.rpm). You will need to find the correct version for your Fedora and machine architecture.

More likely it will be (apparently) installed, in which case you could try force a reinstallation. Just be certain that you have access to the correct rpm of the same identical version, download it to be sure. If you are confident, then install with rpm -ivh --force rpm_file.

Then run python and see if you can import rpm and import yum.



来源:https://stackoverflow.com/questions/26300661/fedora-no-module-named-rpm-when-using-yum

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!