如何在意外删除后删除python

时间:2017-03-28 08:42:12

标签: python ubuntu ubuntu-16.04 samba apt

呀。我做到了这一点。这是愚蠢的。

我不知道它会用它来依赖它,只想从头开始安装python 2和3(因为这个问题:https://askubuntu.com/questions/897355/how-to-change-default-idle-for-python)。

现在,我仍然可以使用我的终端,检查了这些答案:

https://askubuntu.com/questions/741265/apt-get-remove-python-150mb-apt-get-install-python-687kb

https://askubuntu.com/questions/437644/i-accidentaly-did-sudo-apt-get-remove-python

然而,在运行sudo apt-get install ubuntu-desktop后,我收到了以下错误:

Setting up python-ldb (2:1.1.24-1ubuntu3) ...
/var/lib/dpkg/info/python-ldb.postinst: 6: /var/lib/dpkg/info/python-ldb.postinst: pycompile: not found
dpkg: error processing package python-ldb (--configure):
 subprocess installed post-installation script returned error exit status 127
No apport report written because MaxReports is reached already
                                                              Setting up python-tdb (1.3.8-2) ...
/var/lib/dpkg/info/python-tdb.postinst: 6: /var/lib/dpkg/info/python-tdb.postinst: pycompile: not found
dpkg: error processing package python-tdb (--configure):
 subprocess installed post-installation script returned error exit status 127
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of python-samba:
 python-samba depends on python-crypto; however:
  Package python-crypto is not configured yet.
 python-samba depends on python-ldb (>= 1.1.2~); however:
  Package python-ldb is not configured yet.
 python-samba depends on python-tdb; however:
  Package python-tdb is not configured yet.

dpkg: error processing package python-samba (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              Processing triggers for libc-bin (2.23-0ubuntu7) ...

Errors were encountered while processing:
 mercurial-common
 python-crypto
 python-dnspython
 python-ldb
 python-tdb
 python-samba
E: Sub-process /usr/bin/dpkg returned an error code (1)

每个apt-get install命令都会抛出此内容。

有没有办法恢复这些依赖关系?

4 个答案:

答案 0 :(得分:1)

https://askubuntu.com/questions/187227/i-run-sudo-apt-get-remove-python2-7-can-i-restore-my-ubuntu-now

  

为此,请手动下载python2.7软件包(及其依赖项),并使用dpkg手动安装它们(绕过需要Python的APT)。一旦安装完毕,apt应该再次运行,所以apt-get install ubuntu-desktop将恢复你的系统。 (如果apt-get仍然不起作用,您可能还需要下载并安装任何缺少的依赖项。)

剂量有效吗?

(dpkg) - https://help.ubuntu.com/lts/serverguide/dpkg.html

答案 1 :(得分:0)

哈利路亚。

sudo apt-get install --reinstall python python-chardet python-colorama python-distlib python-django python-django-tables2 python-six python-html5lib python-lxml python-minimal python-pkg-resources python-setuptools python-urllib3 python-requests python-pip python-virtualenv

sudo apt-get install --reinstall python-dnspython

sudo apt autoremove

sudo apt-get -f install

经过一整天的互联网最深处的冒险,这些命令对我有用。

在第一个命令--reinstall python-dnspython拉出samba之后,仍然缺少python-dnspython和samba。 Autoremove删除了不必要的依赖项。

答案 2 :(得分:0)

您可以只运行

来恢复所有内容

sudo apt install gnome

即使您只剩下核心部分

答案 3 :(得分:0)

我执行了以下操作,并且能够完全恢复我的系统:

1)sudo apt-get install --reinstall python python-chardet python-colorama python-distlib python-django python-django-tables2 python-six python-html5lib python-lxml python-minimal python-pkg-resources python-setuptools python-urllib3 python-requests python-pip python-virtualenv sudo apt-get install --reinstall python-dnspython sudo apt autoremove sudo apt-get -f install

2)运行MattSom上面给出的4条命令(感谢他):

sudo apt-get install --reinstall ubuntu-desktop

但是GUI仍然不可用。我也跑到下面来恢复它:

3)list