如何撤消“ yum remove python”


12

我有一个通过SSH连接的基于Centos 6的VPS。最近想安装python 2.7.2,我勇敢地跑了:

yum remove python

这显然删除了yum本身正在编写或依赖于python。

现在我不知道该怎么办并使事情变得更糟,我是一个完整的Linux新手(命令行或其他方式)。

运行rpm -iv http://centos.mirrors.hoobly.com/6.0/os/x86_64/Packages/python-2.6.5-3.el6.x86_64.rpm给出:

Retrieving http://centos.mirrors.hoobly.com/6.0/os/x86_64/Packages/python-2.6.5-3.el6.x86_64.rpm
Preparing packages for installation...
        package python-2.6.5-3.el6.x86_64 is already installed

以及它的x86_64服务器,因为“ uname -a”没有问题,它给出了:

Linux xxxxxx 2.6.32-71.29.1.el6.x86_64 #1 SMP Mon Jun 27 19:49:27 BST 2011 x86_64 x86_64 x86_64   GNU/Linux

还有一件事:ls /usr/bin/pyth* -la给出:

lrwxrwxrwx 1 root root    6 Dec  4 20:31 python2 -> python
-rwxr-xr-x 2 root root 4864 Nov 12  2010 python2.6
-rwxr-xr-x 2 root root 4864 Nov 12  2010 python;4edbd894

谢谢,我今天也看到了同样的事情。保持冷静,永不运行yum擦除python:keepcalmandcarryon.com/creator/?shortcode=qCsMlpyc
阿伦·

Answers:


19

CentOS 6镜像列表中选择一个镜像,然后使用安装所需的软件包rpm。您将需要处理依赖性。幸运的是,我有一台安装了CentOS 6 x86_64的漂亮裸机。

我快照了虚拟机,运行yum remove python并通过一些循环依赖获得了一些乐趣。最后结果:

# --nodeps: because of circular dependency between python and python-libs
rpm -i --nodeps http://centos.mirrors.hoobly.com/6.0/os/x86_64/Packages/python-libs-2.6.5-3.el6.x86_64.rpm
rpm -i http://centos.mirrors.hoobly.com/6.0/os/x86_64/Packages/python-2.6.5-3.el6.x86_64.rpm
rpm -i http://centos.mirrors.hoobly.com/6.0/os/x86_64/Packages/pygpgme-0.1-18.20090824bzr68.el6.x86_64.rpm
rpm -i http://centos.mirrors.hoobly.com/6.0/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
rpm -i http://centos.mirrors.hoobly.com/6.0/os/x86_64/Packages/python-pycurl-7.19.0-5.el6.x86_64.rpm 
rpm -i http://centos.mirrors.hoobly.com/6.0/os/x86_64/Packages/python-urlgrabber-3.9.1-7.el6.noarch.rpm 
rpm -i http://centos.mirrors.hoobly.com/6.0/os/x86_64/Packages/rpm-python-4.8.0-12.el6.x86_64.rpm 
rpm -i http://centos.mirrors.hoobly.com/6.0/os/x86_64/Packages/yum-metadata-parser-1.1.2-14.1.el6.x86_64.rpm
# --nodeps: because of circular dependency between yum and yum-plugin-fastestmirror
rpm -i --nodeps http://centos.mirrors.hoobly.com/6.0/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.26-11.el6.noarch.rpm
rpm -i http://centos.mirrors.hoobly.com/6.0/os/x86_64/Packages/yum-3.2.27-14.el6.centos.noarch.rpm

更换镜子,随心所欲。另外,请确保架构匹配。那应该可以解决问题!

另一件事是:如果我是您,yum upgrade那么在完成RPM安装之后,我会立即运行。


那将很棒
Rabih Kodeih 2011年

运行第一个rpm命令后,python被报告为无法识别的命令:-bash:python:命令未找到
Rabih Kodeih 2011年

1
在安装第二个RPM文件之前,Python将不起作用。讨厌成为“那些”之一,但在粘贴之前尝试理解该命令。也许一个man rpm是为了。
Belmin Fernandez 2011年

我运行了所有第一组8条命令。最后两个是yum,您说的很明显。尽管再次运行它们会给出“已安装”消息。也许我的python目录结构搞砸了。顺便说一句,无论如何安装yum之后,运行yum会给出:“ -bash:/ usr / bin / yum:/ usr / bin / python:错误的解释器:没有这样的文件或目录”
Rabih Kodeih 2011年

运行rpm -iv http://centos.mirrors.hoobly.com/6.0/os/x86_64/Packages/python-2.6.5-3.el6.x86_64.rpm输出并将其作为对您的问题的编辑粘贴。另外,您确定您正在运行x86_64吗?也请运行uname -a该输出并将其粘贴到编辑中。
Belmin Fernandez 2011年
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.