意外删除了 yum 所需的模块 - 如何重新安装?

意外删除了 yum 所需的模块 - 如何重新安装?

我在尝试更新 yum 时遇到问题。它给出了一个错误:

After running yum update

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

   No module named base64

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, Oct 12 2012, 14:36:13)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)]

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

当我尝试删除另一个模块时,我可能意外删除了 base64 模块。

  1. 有没有办法重新安装 base64 模块?

  2. 有没有办法为 Red Hat 重新安装 python2.6?

请注意,缺少 base64 模块,因此yum不起作用。

(Nikolay 的建议)尝试安装 RPM 包:python-devel-2.6.6-36.el6.i686.rpm
python-libs-2.6.6-36.el6.i686.rpm

rpm -ivh --force *
warning: python-devel-2.6.6-36.el6.i686.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
warning: python-libs-2.6.6-36.el6.i686.rpm: Header V4 DSA/SHA1 Signature, key ID 192a7d7d: NOKEY
Preparing...                ########################################### [100%]
   1:python-libs            ########################################### [ 50%]
   2:python-devel      

 ########################################### [100%]

Python:

import urllib2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/urllib2.py", line 92, in <module>
    import base64
ImportError: No module named base64

仍然显示 base64,缺少 python 模块。

答案1

通过安装Python rpm包解决问题,如下所示:

rpm -i --forced python-2.6.6-36.el6.i686.rpm

这将恢复所有丢失的 Python 模块,以便 Python 可以再次运行。

相关内容