我有一个基于 Centos 6 的 VPS,带有 ssh 连接。最近想安装 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
答案1
从列表中选择一个镜像CentOS 6 镜像并使用 安装您需要的软件包rpm
。您需要处理依赖项。幸运的是,我有一个安装了 CentOS 6 x86_64 的裸机 VM。
我拍摄了虚拟机的快照,运行后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 后立即运行。