我无法使用 sudo apt-get install 安装任何东西

我无法使用 sudo apt-get install 安装任何东西

我无法使用 sudo apt-get install 安装任何东西

例如,当我尝试安装 libnlopt-dev 时,出现以下错误:

$ sudo apt-get install libnlopt-dev
[sudo] password for burcak: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: The package apport needs to be reinstalled, but I can't find an archive for it.

当我尝试 dist-upgrade 时,出现以下错误:

$ sudo apt-get dist-upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: The package apport needs to be reinstalled, but I can't find an archive for it.

并且还 sudo dpkg --configure -a出现以下错误:

    $ sudo dpkg --configure -a
Setting up python-gpgme (0.3-1.1) ...
    Traceback (most recent call last):
      File "/usr/bin/pycompile", line 35, in <module>
        from debpython.version import SUPPORTED, debsorted, vrepr, \
      File "/usr/share/python/debpython/version.py", line 24, in <module>
        from ConfigParser import SafeConfigParser
    ImportError: No module named 'ConfigParser'
    dpkg: error processing package python-gpgme (--configure):
     subprocess installed post-installation script returned error exit status 1
    dpkg: dependency problems prevent configuration of apport-gtk:
     apport-gtk depends on apport (>= 0.41); however:
      Package apport is not configured yet.

    dpkg: error processing package apport-gtk (--configure):
     dependency problems - leaving unconfigured
    Setting up python-gobject-2 (2.28.6-12ubuntu1) ...
    Traceback (most recent call last):
      File "/usr/bin/pycompile", line 35, in <module>
        from debpython.version import SUPPORTED, debsorted, vrepr, \
      File "/usr/share/python/debpython/version.py", line 24, in <module>
        from ConfigParser import SafeConfigParser
    ImportError: No module named 'ConfigParser'
    dpkg: error processing package python-gobject-2 (--configure):
     subprocess installed post-installation script returned error exit status 1
    Setting up python-cairo (1.8.8-2) ...
    Traceback (most recent call last):
      File "/usr/bin/pycompile", line 35, in <module>
        from debpython.version import SUPPORTED, debsorted, vrepr, \
      File "/usr/share/python/debpython/version.py", line 24, in <module>
        from ConfigParser import SafeConfigParser
    ImportError: No module named 'ConfigParser'
    dpkg: error processing package python-cairo (--configure):
     subprocess installed post-installation script returned error exit status 1
    Setting up python-lockfile (1:0.12.2-1) ...
    Traceback (most recent call last):
      File "/usr/bin/pycompile", line 35, in <module>
        from debpython.version import SUPPORTED, debsorted, vrepr, \
      File "/usr/share/python/debpython/version.py", line 24, in <module>
        from ConfigParser import SafeConfigParser
    ImportError: No module named 'ConfigParser'
    dpkg: error processing package python-lockfile (--configure):
     subprocess installed post-installation script returned error exit status 1
    Setting up python-pil:amd64 (3.1.2-0ubuntu1.1) ...
    Traceback (most recent call last):
      File "/usr/bin/pycompile", line 35, in <module>
        from debpython.version import SUPPORTED, debsorted, vrepr, \
      File "/usr/share/python/debpython/version.py", line 24, in <module>
        from ConfigParser import SafeConfigParser
    ImportError: No module named 'ConfigParser'
    dpkg: error processing package python-pil:amd64 (--configure):
     subprocess installed post-installation script returned error exit status 1
    dpkg: dependency problems prevent configuration of asymptote:
     asymptote depends on python-pil; however:
      Package python-pil:amd64 is not configured yet.

    dpkg: error processing package asymptote (--configure):
     dependency problems - leaving unconfigured
    dpkg: dependency problems prevent configuration of nautilus-dropbox:
     nautilus-dropbox depends on python-gpgme; however:
      Package python-gpgme is not configured yet.

    dpkg: error processing package nautilus-dropbox (--configure):
     dependency problems - leaving unconfigured
    dpkg: dependency problems prevent configuration of python-gtk2:
     python-gtk2 depends on python-cairo (>= 1.0.2-1.1); however:
      Package python-cairo is not configured yet.
     python-gtk2 depends on python-gobject-2 (>= 2.21.3); however:
      Package python-gobject-2 is not configured yet.

    dpkg: error processing package python-gtk2 (--configure):
     dependency problems - leaving unconfigured
    dpkg: dependency problems prevent configuration of python-pil.imagetk:amd64:
     python-pil.imagetk:amd64 depends on python-pil (= 3.1.2-0ubuntu1.1); however:
      Package python-pil:amd64 is not configured yet.

    dpkg: error processing package python-pil.imagetk:amd64 (--configure):
     dependency problems - leaving unconfigured
    Processing triggers for libc-bin (2.23-0ubuntu9) ...
    Errors were encountered while processing:
     python-gpgme
     apport-gtk
     python-gobject-2
     python-cairo
     python-lockfile
     python-pil:amd64
     asymptote
     nautilus-dropbox
     python-gtk2
     python-pil.imagetk:amd64

有什么帮助吗?

答案1

从这些错误信息中:

E: The package apport needs to be reinstalled, but I can't find an archive for it.
Package apport is not configured yet.

apport 似乎存在问题。
请更改您的下载服务器,然后尝试重新安装 apport。

sudo apt install --reinstall apport

编辑1

要更改下载服务器,请在 dash 中搜索“软件和更新”并打开它。在第一个选项卡的“下载自”部分中,如果选择了其他服务器,请选择主服务器。
参见下面的屏幕截图:

在此处输入图片描述

相关内容