【问题标题】:How to restore after accidentally apt-get remove python意外apt-get remove python后如何恢复
【发布时间】:2017-08-21 05:45:57
【问题描述】:

是的。我已经做到了。这很愚蠢。

我不知道它会自带依赖,只想从头开始安装 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 命令都会抛出这个。

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

【问题讨论】:

  • 尝试使用“apt-get install -f”它可能会修复损坏的依赖项
  • @Abhimanyusingh 不,遗憾的是它抛出了相同的:(

标签: python ubuntu ubuntu-16.04 samba apt


【解决方案1】:

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

1) sudo apt-get update

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

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

但 GUI 仍然不可用。我也在下面运行以恢复它:

3)sudo apt-get install --reinstall ubuntu-desktop

【讨论】:

    【解决方案2】:

    哈利路亚。

    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
    

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

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

    当然,其中一些可能是多余的,但我只是在到处关注一些长期丢失的论坛帖子,重要的是它有效。

    【讨论】:

    • 经过几个小时的挖掘,这篇文章挽救了我的理智和我的电脑。非常感谢。
    【解决方案3】:

    你可以通过运行再次恢复一切

    sudo apt install gnome

    即使你只留下内核

    【讨论】:

      【解决方案4】:

      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

      【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-09-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多