意外apt-get删除python后如何恢复

Mat*_*Som 3 python apt 16.04

是的,我这样做了,这很愚蠢。

我不知道它会拉它的依赖关系,我只是想从头开始安装 python 2 和 3(因为这个问题:如何更改 python 的默认空闲?)。

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

apt-get 删除 python ~150Mb / apt-get 安装 python 687kb

我不小心做了 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)
Run Code Online (Sandbox Code Playgroud)

恢复这些依赖的方法是什么(16.04 LTS)?

Mat*_*Som 5

今天下午终于搞定了。

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
Run Code Online (Sandbox Code Playgroud)

在互联网最深的坑里冒险了一整天后,这些命令对我有用。

python-dnspython 和 samba 在第一个命令后仍然丢失,也--reinstall python-dnspython拉入了 samba。Autoremove 删除了不必要的依赖项。

  • 关键部分可能是重新安装“python-minimal”。在一个简短的命令中,即“sudo apt-get install -f --reinstall python-minimal”。 (2认同)