在终端上安装时出现问题,我一直收到“E: 子进程 /usr/bin/dpkg 返回错误代码 (1)”

在终端上安装时出现问题,我一直收到“E: 子进程 /usr/bin/dpkg 返回错误代码 (1)”

我最近安装了 Ubuntu。最初一切都很顺利,安装按照各个线程中的说明进行。

我现在在尝试下载 Python 编辑器时遇到了一个问题,特别是在尝试构建和安装 qt5 时。当我尝试使用安装 g++ 时,sudo apt-get install build-essential我收到以下错误:

Reading package lists... Done
Building dependency tree... 50%
Building dependency tree       
Reading state information... Done
build-essential is already the newest version (12.1ubuntu2).
0 to upgrade, 0 to newly install, 0 to remove and 13 not to upgrade.
8 not fully installed or removed.
Need to get 0 B/119 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] dpkg: error processing package apport (--configure):
 package is in a very bad inconsistent state; you should
 reinstall it before attempting configuration
No apport report written because the error message indicates it's a follow-up error from a previous failure.
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-cairo (1.8.8-2) ...
/var/lib/dpkg/info/python-cairo.postinst: 6: /var/lib/dpkg/info/python-cairo.postinst: pycompile: not found

dpkg: error processing package python-cairo (--configure):
 subprocess installed post-installation script returned error exit status 127
Setting up python-gobject-2 (2.28.6-12ubuntu1) ...
/var/lib/dpkg/info/python-gobject-2.postinst: 6: /var/lib/dpkg/info/python-gobject-2.postinst: pycompile: not found

dpkg: error processing package python-gobject-2 (--configure):
 subprocess installed post-installation script returned error exit status 127
No apport report written because MaxReports has already been reached

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
No apport report written because MaxReports has already been reached

dpkg: dependency problems prevent configuration of python-glade2:
 python-glade2 depends on python-gtk2 (= 2.24.0-4ubuntu1); however:
  Package python-gtk2 is not configured yet.

dpkg: error processing package python-glade2 (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports has already been reached
dpkg: dependency problems prevent configuration of python-vte:
 python-vte depends on python-gtk2; however:
  Package python-gtk2 is not configured yet.

dpkg: error processing package python-vte (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports has already been reached

dpkg: dependency problems prevent configuration of pypar2:
 pypar2 depends on python-gtk2 (>= 2.8.6-1); however:
  Package python-gtk2 is not configured yet.
 pypar2 depends on python-glade2 (>= 2.8.6-1); however:
  Package python-glade2 is not configured yet.
 pypar2 depends on python-vte (>= 0.12.2-1); however:
  Package python-vte is not configured yet.

dpkg: error processing package pypar2 (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports has already been reached
Processing triggers for libc-bin (2.23-0ubuntu3) ...
Errors were encountered while processing:
 apport
 apport-gtk
 python-cairo
 python-gobject-2
 python-gtk2
 python-glade2
 python-vte
 pypar2
E: Sub-process /usr/bin/dpkg returned an error code (1)

有人可以帮忙吗?

答案1

解决有时并不那么容易,特别是apport涉及到解决问题本身时,我会采用以下方法:

首先,如上所述,请apt更新您的列表:

sudo apt-get update

现在来修复问题本身:

sudo apt-get install --reinstall apport
sudo apt-get -f install
sudo apt-get dist-upgrade

如果这还不够,可以从以下位置下载相关软件包packages.ubuntu.com并使用以下命令安装它们:

sudo dpkg -i <package-name>

答案2

您持有的软件包处于不一致状态。请运行sudo apt updatesudo apt-get -f install解决依赖关系问题。

相关内容