我看到了很多这样的其他问题,但是他们没有一个回答我遇到问题的确切部分(实际上安装了Python RPM)。 我的系统上有人在我的64位CentOS 5.8安装上删除了/ usr / bin / python和/usr/bin/python2.4。 我从源代码重新编译Python 2.4,但现在每当我尝试yum安装任何东西,我得到以下错误:
[root@cerulean-OW1 ~]# yum install httpd There was a problem importing one of the Python modules required to run yum. The error leading to this problem was: No module named yum 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.4 (#1, Dec 16 2012, 09:16:56) [GCC 4.1.2 20080704 (Red Hat 4.1.2-52)] If you cannot solve this problem yourself, please go to the yum faq at: http://wiki.linux.duke.edu/YumFaq
我检查了http://wiki.linux.duke.edu/YumFaq ,它说:
If you are getting a message that yum itself is the missing module then you probably installed it incorreclty (or installed the source rpm using make/make install). If possible, find a prebuilt rpm that will work for your system like one from Fedora or CentOS. Or, you can download the srpm and do a rpmbuild --rebuild yum*.src.rpm
我试着去http://rpm.pbone.net/index.php3/stat/4/idpl/17838875/dir/centos_5/com/python-2.4.3-46.el5.x86_64.rpm.html来安装Python ,导致以下错误:
[root@cerulean-OW1 ~]# rpm -Uvh python-2.4.3-46.el5.x86_64.rpm error: Failed dependencies: python-libs-x86_64 = 2.4.3-46.el5 is needed by python-2.4.3-46.el5.x86_64
所以我试着安装python-libs-x86_64,结果如下:
[root@cerulean-OW1 ~]# rpm -Uvh python-libs-2.4.3-46.el5_8.2.x86_64.rpm warning: python-libs-2.4.3-46.el5_8.2.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 192a7d7d Preparing... ########################################### [100%] package python-libs-2.4.3-46.el5_8.2.x86_64 is already installed file /usr/lib64/libpython2.4.so.1.0 from install of python-libs-2.4.3-46.el5_8.2.x86_64 conflicts with file from package python-libs-2.4.3-46.el5_8.2.x86_64
是的,你应该从RPM重新安装python。 我假设你有一些Centos安装媒体,因为你显然已经安装了。 如果你不这样做:
这可能有助于1
请注意:你没有提到一个特定的版本或架构,所以这个链接在黑暗中是一个刺
使用--replacefiles --replacepkgs和--nodeps选项来强制重新安装这些软件包:
rpm --replacefiles --replacepkgs --nodeps -ivh python-libs-2.4.3-46.el5_8.2.x86_64.rpm python-2.4.3-46.el5.x86_64.rpm
一旦python再次处于半工作状态,您应该使用yum distro-sync来获取已安装的系统软件包的当前版本,如果这些版本碰巧不是最新版本的话。
对于你提到的configuration(64位CentOS 5.8),请从这里下载你的软件包(python及其依赖项): http : //mirror.centos.org/centos/5.8/updates/x86_64/RPMS/
然后,只需要从那里下载一个rpm -ivh ,然后用rpmbuild安装yum –rebuild yum * .src.rpm