“Sudo apt-get install -f”不会修复依赖项

“Sudo apt-get install -f”不会修复依赖项

我正在尝试使用 apt-get 安装一些软件包,但它似乎陷入了某种依赖循环中。

我读过类似的问题/答案,但给出的解决方案都不起作用。

这是 的输出和错误消息apt-get install -f。看起来像是python的问题?有什么建议吗?

非常感谢。

sudo apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  cdbs freepats gir1.2-gtksource-3.0 gir1.2-gucharmap-2.90 glib-networking-common gnustep-common gsettings-desktop-schemas gstreamer0.10-plugins-bad gstreamer0.10-x
  html2text libaa1 libao-common libao4 libass4 libaudio2 libavc1394-0 libblas-dev libbz2-dev libcaca0 libcdaudio1 libdc1394-22 libdca0 libdirectfb-1.2-9 libdv4 libdvdnav4
  libdvdread4 libenca0 libfaad2 libflite1 libgail-3-0 libgeoclue0 libgme0 libgraphite3 libgstreamer-plugins-bad0.10-0 libgucharmap-2-90-7 libiec61883-0 libjpeg8-dev
  libkate1 libkpathsea6 liblapack-dev liblcms1 libmhash2 libmimic0 libmms0 libmodplug1 libmpcdec6 libnotify4 libobjc4 libofa0 libopenal-data libopenal1 libopus0
  libpoppler19 libptexenc1 libraptor2-0 librasqal3 libraw1394-11 librdf0 libreadline-dev libshout3 libslv2-9 libsoundtouch0 libspandsp2 libtag1-vanilla libtag1c2a
  libts-0.0-0 libvo-aacenc0 libvo-amrwbenc0 libwavpack1 libwebkitgtk-3.0-common libwildmidi-config libwildmidi1 libxfont1 libyajl2 libyaml-tiny-perl libzbar0 libzvbi-common
  libzvbi0 lmodern luatex notification-daemon tex-common tex-gyre texlive-common texlive-doc-base texlive-fonts-recommended-doc texlive-latex-base-doc
  texlive-latex-recommended-doc texlive-pstricks-doc tsconf ttf-dejavu ttf-freefont ttf-marvosym xfonts-encodings xfonts-utils yelp-xsl zenity-common
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  aspell build-essential dictionaries-common dpkg-dev gir1.2-freedesktop gir1.2-glib-2.0 gobject-introspection ienglish-common ispell libalgorithm-diff-xs-perl
  libapt-pkg-perl libaspell15 libaugeas0 libauthen-pam-perl libbit-vector-perl libbsd-resource-perl libcairo-perl libclass-c3-xs-perl libclass-methodmaker-perl
  libclone-perl libconfig-augeas-perl libconvert-binary-c-perl libcrypt-ssleay-perl libcurses-perl libdata-alias-perl libdate-calc-xs-perl libdbd-mysql-perl libdbd-pg-perl
  libdbd-sqlite3-perl libdbi-perl libdpkg-perl libelfg0 libfcgi-perl libfile-fcntllock-perl libfuse-perl libgd-perl libgirepository-1.0-1 libgirepository1.0-dev
  libglib-perl libglib2.0-0 libglib2.0-bin libglib2.0-dev libio-pty-perl liblocale-gettext-perl libtext-iconv-perl patch perl-base python python-gi python-gi-cairo
Suggested packages:
  aspell-doc spellutils debian-keyring spell augeas-tools libfont-freetype-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl libunix-mknod-perl liblchown-perl
  libfilesys-statvfs-perl libgirepository1.0-doc diffutils-doc python-doc python-tk
Recommended packages:
  iamerican iamerican-small iamerican-large iamerican-huge iamerican-insane ibritish ibritish-small ibritish-large ibritish-huge ibritish-insane xdg-user-dirs
The following packages will be REMOVED:
  libgd-gd2-perl
The following NEW packages will be installed:
  aspell build-essential dictionaries-common dpkg-dev ienglish-common ispell libdpkg-perl libelfg0 libgd-perl libio-pty-perl libtext-iconv-perl
The following packages will be upgraded:
  gir1.2-freedesktop gir1.2-glib-2.0 gobject-introspection libalgorithm-diff-xs-perl libapt-pkg-perl libaspell15 libaugeas0 libauthen-pam-perl libbit-vector-perl
  libbsd-resource-perl libcairo-perl libclass-c3-xs-perl libclass-methodmaker-perl libclone-perl libconfig-augeas-perl libconvert-binary-c-perl libcrypt-ssleay-perl
  libcurses-perl libdata-alias-perl libdate-calc-xs-perl libdbd-mysql-perl libdbd-pg-perl libdbd-sqlite3-perl libdbi-perl libfcgi-perl libfile-fcntllock-perl libfuse-perl
  libgirepository-1.0-1 libgirepository1.0-dev libglib-perl libglib2.0-0 libglib2.0-bin libglib2.0-dev liblocale-gettext-perl patch perl-base python python-gi
  python-gi-cairo
39 upgraded, 11 newly installed, 1 to remove and 1067 not upgraded.
14 not fully installed or removed.
Need to get 0 B/17.7 MB of archives.
After this operation, 11.2 MB of additional disk space will be used.
Do you want to continue [Y/n]?
Reading changelogs... Done
Extracting templates from packages: 100%
Preconfiguring packages ...
 dict-common::dc_set: dictionaries-common/default-ispell is already set to
      [american (American English)]. Preserving it.
 dict-common::dc_set: dictionaries-common/default-wordlist is already set to
      [american (American English)]. Preserving it.
Setting up python-minimal (2.7.9-1) ...
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/local/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/lib/python2.7/compileall.py", line 16, in <module>
    import struct
  File "/usr/local/lib/python2.7/struct.py", line 1, in <module>
    from _struct import *
ImportError: No module named _struct
dpkg: error processing package python-minimal (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 python-minimal
E: Sub-process /usr/bin/dpkg returned an error code (1)

编辑:按照建议,我尝试使用 apt-get 重新安装 python-minimal 并收到以下错误

sudo apt-get install --reinstall python2.7-minimal
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 libalgorithm-diff-xs-perl : Depends: perlapi-5.14.2
 libapt-pkg-perl : Depends: perlapi-5.14.2
 libbit-vector-perl : Depends: perlapi-5.14.2
 libbsd-resource-perl : Depends: perlapi-5.14.2
 libcairo-perl : Depends: perlapi-5.14.2
 libclass-c3-xs-perl : Depends: perlapi-5.14.2
 libclass-methodmaker-perl : Depends: perlapi-5.14.2
 libclone-perl : Depends: perlapi-5.14.2
 libconfig-augeas-perl : Depends: perlapi-5.14.2
 libconvert-binary-c-perl : Depends: perlapi-5.14.2
 libcrypt-ssleay-perl : Depends: perlapi-5.14.2
 libcurses-perl : Depends: perlapi-5.14.2
 libdata-alias-perl : Depends: perlapi-5.14.2
 libdate-calc-xs-perl : Depends: perlapi-5.14.2
 libdbd-mysql-perl : Depends: perlapi-5.14.2
 libdbd-pg-perl : Depends: perlapi-5.14.2
 libdbd-sqlite3-perl : Depends: perlapi-5.14.2
 libdbi-perl : Depends: perlapi-5.14.2
 libfcgi-perl : Depends: perlapi-5.14.2
 libfile-fcntllock-perl : Depends: perlapi-5.14.2
 libfuse-perl : Depends: perlapi-5.14.2
 libgd-gd2-perl : Depends: perlapi-5.14.2
 libglib-perl : Depends: perlapi-5.14.2
 liblocale-gettext-perl : PreDepends: perlapi-5.14.2
 python : Depends: python-minimal (= 2.7.3-4+deb7u1) but 2.7.9-1 is to be installed
 python-dev : Depends: python (= 2.7.9-1) but 2.7.3-4+deb7u1 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).


sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 aspell-en : Depends: aspell (>= 0.60.3-2) but it is not installed
             Depends: dictionaries-common (>= 0.49.2) but it is not installed
 iamerican : Depends: dictionaries-common but it is not installed
             Depends: ienglish-common (= 3.3.02-6) but it is not installed
             Depends: ispell but it is not installed
 ibritish : Depends: dictionaries-common but it is not installed
            Depends: ienglish-common (= 3.3.02-6) but it is not installed
            Depends: ispell but it is not installed
 libalgorithm-diff-xs-perl : Depends: perlapi-5.14.2
 libapt-pkg-perl : Depends: perlapi-5.14.2
 libbit-vector-perl : Depends: perlapi-5.14.2
 libbsd-resource-perl : Depends: perlapi-5.14.2
 libcairo-perl : Depends: perlapi-5.14.2
 libclass-c3-xs-perl : Depends: perlapi-5.14.2
 libclass-methodmaker-perl : Depends: perlapi-5.14.2
 libclone-perl : Depends: perlapi-5.14.2
 libconfig-augeas-perl : Depends: perlapi-5.14.2
 libconvert-binary-c-perl : Depends: perlapi-5.14.2
 libcrypt-ssleay-perl : Depends: perlapi-5.14.2
 libcurses-perl : Depends: perlapi-5.14.2
 libdata-alias-perl : Depends: perlapi-5.14.2
 libdate-calc-xs-perl : Depends: perlapi-5.14.2
 libdbd-mysql-perl : Depends: perlapi-5.14.2
 libdbd-pg-perl : Depends: perlapi-5.14.2
 libdbd-sqlite3-perl : Depends: perlapi-5.14.2
 libdbi-perl : Depends: perlapi-5.14.2
 libfcgi-perl : Depends: perlapi-5.14.2
 libfile-fcntllock-perl : Depends: perlapi-5.14.2
 libfuse-perl : Depends: perlapi-5.14.2
 libgd-gd2-perl : Depends: perlapi-5.14.2
 libglib-perl : Depends: perlapi-5.14.2
 liblocale-gettext-perl : PreDepends: perlapi-5.14.2
 python : Depends: python-minimal (= 2.7.3-4+deb7u1) but 2.7.9-1 is installed
 python-dev : Depends: python (= 2.7.9-1) but 2.7.3-4+deb7u1 is installed
E: Unmet dependencies. Try using -f.

答案1

你的最后一行sources.list指向杰西。

Wheezy 是 Debian 的上一个稳定版本,Jessie 是当前版本。而 Wheezy 现在只得到很少的更新。

当你刚刚运行时apt-get install <package>,它会尝试安装它能找到的最新版本(除非你设置了一些固定设置,但如果你设置了,你应该了解它,并且应该充分了解 apt 的工作原理,以免永远不会到达你想要的位置。是,所以我认为可以安全地假设您没有),这几乎总是来自 Jessie,但在 Wheezy 上安装 Jessie 软件包会带来麻烦。

由于除了最后一行指向爱尔兰的镜子和最后一行指向美国之外的所有行,这表明您可能在完全不知道自己在做什么的情况下添加了它?请小心,并阅读一些有关维护 Debian 系统的内容。

由于您的系统上可能已经有 Jessie 软件包,唯一明智的方法就是升级到 Jessie。网上有很多指南,但简而言之:

  • 更改wheezyjessie中的任何地方/etc/apt/sources.list
  • 跑步apt-get update
  • 跑步apt-get dist-upgrade

编辑时sources.list只需删除最后一行即可。

答案2

看起来问题是由于安装了本地版本的 python 造成的,在删除本地 python 安装并使用 dpkg “手动”安装 python-minimal 后,我能够运行 apt-get -f 。谢谢大家的意见。

相关内容