无法从 16.10 升级到 17.04,现在 APT 抛出错误

无法从 16.10 升级到 17.04,现在 APT 抛出错误

升级失败后,顶部菜单栏上出现了一个新图标

错误:BrokonCount >0

当我想升级或安装任何软件包时,我遇到了这个问题

$ sudo apt-get upgrade
        Reading package lists... Done
        Building dependency tree       
        Reading state information... Done
        You might want to run 'apt --fix-broken install' to correct these.
        The following packages have unmet dependencies:
         python3 : PreDepends: python3-minimal (= 3.5.1-4) but 3.5.3-1 is installed
         python3-dev : Depends: python3 (= 3.5.3-1) but 3.5.1-4 is installed
                       Depends: libpython3-dev (= 3.5.3-1) but 3.5.1-4 is installed
        E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

当我尝试此命令“apt --fix-broken install”时,我收到以下消息:

$ sudo apt --fix-broken install 
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:
  libidl-2-0 libjson-c3:i386 libkeybinder0 liborbit2 libudev1:i386 libvte-common libvte9 libwings3 libwraster5 libwutil5 linux-headers-4.8.0-34
  linux-headers-4.8.0-34-generic linux-headers-4.8.0-37 linux-headers-4.8.0-37-generic linux-headers-4.8.0-38 linux-headers-4.8.0-38-generic
  linux-headers-4.8.0-39 linux-headers-4.8.0-39-generic linux-headers-4.8.0-41 linux-headers-4.8.0-41-generic linux-headers-4.8.0-44
  linux-headers-4.8.0-44-generic linux-image-4.8.0-34-generic linux-image-4.8.0-37-generic linux-image-4.8.0-38-generic linux-image-4.8.0-39-generic
  linux-image-4.8.0-41-generic linux-image-4.8.0-44-generic linux-image-extra-4.8.0-34-generic linux-image-extra-4.8.0-37-generic
  linux-image-extra-4.8.0-38-generic linux-image-extra-4.8.0-39-generic linux-image-extra-4.8.0-41-generic linux-image-extra-4.8.0-44-generic
  python-appindicator python-apport python-gconf python-gnome2 python-keybinder python-notify python-piston-mini-client python-problem-report
  python-pyorbit python-vte ubuntu-core-launcher
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libpython3-dev libpython3-stdlib python3
Suggested packages:
  python3-doc python3-tk python3-venv
The following packages will be upgraded:
  libpython3-dev libpython3-stdlib python3
3 upgraded, 0 newly installed, 0 to remove and 1484 not upgraded.
5 not fully installed or removed.
Need to get 0 B/22.5 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up python3.5-minimal (3.5.3-1) ...
Traceback (most recent call last):
  File "/usr/lib/python3.5/py_compile.py", line 6, in <module>
    import importlib._bootstrap_external
  File "/usr/lib/python3.5/importlib/__init__.py", line 57, in <module>
    import types
  File "/usr/lib/python3.5/types.py", line 166, in <module>
    import functools as _functools
  File "/usr/lib/python3.5/functools.py", line 23, in <module>
    from weakref import WeakKeyDictionary
  File "/usr/lib/python3.5/weakref.py", line 12, in <module>
    from _weakref import (
ImportError: cannot import name '_remove_dead_weakref'
dpkg: error processing package python3.5-minimal (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of python3-minimal:
 python3-minimal depends on python3.5-minimal (>= 3.5.3-1~); however:
  Package python3.5-minimal is not configured yet.

dpkg: error processing package python3-minimal (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Errors were encountered while processing:
 python3.5-minimal
 python3-minimal
E: Sub-process /usr/bin/dpkg returned an error code (1)

我怎么解决这个问题?

答案1

以下内容基于此链接,评论者采取的哪些步骤对我有用。

  1. 运行sudo nautilus(在你的终端中)
  2. 转到/usr/local/bin并删除其中包含“python3”的任何文件/快捷方式/文件夹
  3. 前往/usr/local/lib并执行相同操作
  4. 打开一个新的终端(例如,使用Ctrl++ )AltT
  5. 跑步

    sudo apt --fix-broken install &&
         sudo apt -y update &&
         sudo apt -y upgrade &&
         sudo apt -y dist-upgrade &&
         sudo apt -f install &&
         sudo apt -y autoremove &&
         sudo apt autoclean &&
         sudo apt clean
    

    (如果您愿意,可以将其合并为更少的行。)

  6. 重启

  7. 再次运行 5 号

相关内容