![恢复 Python 安装](https://linux22.com/image/981753/%E6%81%A2%E5%A4%8D%20Python%20%E5%AE%89%E8%A3%85.png)
我使用的是 ubuntu precise。此版本上安装的 Python 版本是 2.7.6。但 Cloudera 需要 2.7.3。我只是按照这。整个系统都无法运行。我甚至无法安装 jdk。我想要的是恢复此更改。我需要以某种方式恢复到默认的 2.7.6。
有什么建议么?
编辑1
E: Sub-process /usr/bin/dpkg returned an error code (1)
sudo dpkg -C returns
The following packages have been unpacked but not yet configured.
They must be configured using dpkg --configure or the configure
menu option in dselect for them to work:
libgnome2-0:amd64 The GNOME library - runtime files
libgnome2-bin The GNOME library - binary files
libgnome2-common The GNOME library - common files
libgnomevfs2-0:amd64 GNOME Virtual File System (runtime libraries)
libgnomevfs2-common GNOME Virtual File System (common files)
The following packages are only half configured, probably due to problems
configuring them the first time. The configuration should be retried using
dpkg --configure <package> or the configure menu option in dselect:
gconf2 GNOME configuration database system (support tools)
如果我尝试重新配置,那么它就像一个循环错误。最后它指向 Python IO 模块错误
编辑2
Reading package lists... Done
Building dependency tree
Reading state information... Done
python is already the newest version.
The following packages were automatically installed and are no longer required:
gcc-4.8-base:i386 libasan0:i386 libatomic1:i386 libc6-dev:i386 libgcc-4.8-dev:i386 libgmp-dev:i386 libgmpxx4ldbl:i386 libgnutls-dev:i386 libgnutls-openssl27:i386
libgnutls28-dev:i386 libgnutlsxx28:i386 libgomp1:i386 libitm1:i386 liboath-dev:i386 liboath0:i386 libopenconnect3:i386 libp11-kit-dev:i386 libproxy-dev:i386
libproxy1:i386 libquadmath0:i386 libstdc++-4.8-dev:i386 libstoken-dev:i386 libstoken1:i386 libtasn1-6-dev:i386 libtomcrypt-dev:i386 libtomcrypt0:i386 libtommath0:i386
libxml2:i386 libxml2-dev:i386 linux-libc-dev:i386 nettle-dev:i386 zlib1g-dev:i386
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 293 not upgraded.
6 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up gconf2 (3.2.6-2ubuntu1) ...
/var/lib/dpkg/info/gconf2.postinst: 74: /var/lib/dpkg/info/gconf2.postinst: gconf-schemas: not found
dpkg: error processing package gconf2 (--configure):
subprocess installed post-installation script returned error exit status 127
dpkg: dependency problems prevent configuration of libgnomevfs2-common:
libgnomevfs2-common depends on gconf2 (>= 2.28.1-2); however:
Package gconf2 is not configured yet.
dpkg: error processing package libgnomevfs2-common (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libgnomevfs2-0:amd64:
libgnomevfs2-0:amd64 depends on libgnomevfs2-common (= 1:2.24.4-6ubuntu1); however:
Package libgnomevfs2-common is not configured yet.
dpkg: error processing package libgnomevfs2-0:amd64 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libgnome2-common:
libgnome2-common depends on gconf2 (>= 2.28.1-2); however:
Package gconf2 is not configured yet.
dpkg: error processing package libgnome2-common (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libgnome2-0:amd64:
libgnome2-0:amd64 depends on libgnomevfs2-0 (>= No apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
No apport report written because MaxReports is reached already
1:2.17.90); however:
Package libgnomevfs2-0:amd64 is not configured yet.
libgnome2-0:amd64 depends on libgnome2-common (>= 2.32); however:
Package libgnome2-common is not configured yet.
libgnome2-0:amd64 depends on libgnome2-common (<< 2.33); however:
Package libgnome2-common is not configured yet.
dpkg: error processing package libgnome2-0:amd64 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of libgnome2-bin:
libgnome2-bin depends on libgnome2-0 (>= 2.17.3); however:
Package libgnome2-0:amd64 is not configured yet.
dpkg: error processing package libgnome2-bin (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
gconf2
libgnomevfs2-common
libgnomevfs2-0:amd64
libgnome2-common
libgnome2-0:amd64
libgnome2-bin
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
可能你在从 apt-get 重新安装 Python 时遇到了问题,因为 tarball 安装已经创建了 Python 中使用的文件
您可以下载 python 包及其依赖项,将所有文件放在同一目录中,然后使用 dpkg 安装并覆盖现有文件:
要获取 requeride 包,您只需运行
apt-get install python
即可获取 apt 要安装的包列表。要下载它们,请
apt-get download [paste here the list of the packages]
在空文件夹中使用命令要安装,请在同一文件夹中使用:
dpkg --force-overwrite -i *.deb
我希望这个办法能奏效。祝你好运。
编辑:我的回答没有考虑到该编辑。您必须先修复 libgnome* 软件包中出现的问题,然后再尝试上述操作。
答案2
正如我在另一篇文章中看到的那样,您考虑重新安装 ubuntu,那么您可以尝试以下操作:
$ dpkg --list | grep -i python > ~/pythonpackages.txt
$ ### txt file just to review what was installed
$ sudo apt-get purge python* #remove all python related packages
$ sudo rm -rf /var/lib/apt/lists #remove apt information
$ sudo updatedb #refill the file location database
$ locate python #find all python related files
$ # remove all directories and files that you find with python
$ apt-get update
$ apt-get install python
注意:这不是彻底的清理或恢复,而是对与 Python 有关的任何内容进行更彻底的删除。因此,您可以重新尝试安装所有 Python 包。