无法升级软件包,如下所示

无法升级软件包,如下所示

我在 Ubuntu 18.04LTS 上。当我运行时sudo apt update,结果显示4 packages can be upgraded. Run 'apt list --upgradable' to see them.

但是,当我运行sudo apt upgrade它时显示

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded

当我运行sudo apt dist-upgradesudo apt full-upgrade它显示相同的结果时。我发现这个问题找不到软件包未升级的原因。如何解决? 找到没有答案的问题

当我运行时sudo apt list --upgradable它显示以下内容

$ sudo apt list --upgradable
Listing... Done
python3-distutils/bionic,bionic 3.6.9-1~18.04 all [upgradable from: 3.6.7-1~18.04]
python3-gdbm/bionic 3.6.9-1~18.04 amd64 [upgradable from: 3.6.7-1~18.04]
python3-lib2to3/bionic,bionic 3.6.9-1~18.04 all [upgradable from: 3.6.7-1~18.04]
python3-tk/bionic 3.6.9-1~18.04 amd64 [upgradable from: 3.6.7-1~18.04]

运行时sudo apt full-upgrade显示,

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

当尝试手动安装软件包时显示此错误

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 python3-distutils : Depends: python3 (>= 3.6.8-1~) but 3.6.7-1~18.04 is to be installed
 python3-gdbm : Depends: python3 (>= 3.6.8-1~) but 3.6.7-1~18.04 is to be installed
 python3-lib2to3 : Depends: python3 (>= 3.6.8-1~) but 3.6.7-1~18.04 is to be installed
 python3-tk : Depends: python3 (>= 3.6.8-1~) but 3.6.7-1~18.04 is to be installed
E: Unable to correct problems, you have held broken packages.

输出apt-cache policy python3-distutils

python3-distutils:
  Installed: 3.6.7-1~18.04
  Candidate: 3.6.9-1~18.04
  Version table:
     3.6.9-1~18.04 500
        500 http://ppa.launchpad.net/ubuntu-toolchain-r/ppa/ubuntu bionic/main amd64 Packages
        500 http://ppa.launchpad.net/ubuntu-toolchain-r/ppa/ubuntu bionic/main i386 Packages
     3.6.8-1~18.04 500
        500 http://lk.archive.ubuntu.com/ubuntu bionic-updates/main amd64 Packages
        500 http://lk.archive.ubuntu.com/ubuntu bionic-updates/main i386 Packages
 *** 3.6.7-1~18.04 100
        100 /var/lib/dpkg/status
     3.6.5-3 500
        500 http://lk.archive.ubuntu.com/ubuntu bionic/main amd64 Packages
        500 http://lk.archive.ubuntu.com/ubuntu bionic/main i386 Packages

答案1

我无法回答为什么会发生这种情况,但您可以采取一些措施来解决问题或将软件包升级到最新版本。

首先,运行以下命令清除缓存并升级:

sudo apt clean
sudo apt update
sudo apt dist-upgrade

如果这不起作用,请运行以下命令来明确安装软件包(但要小心在接受更改之前请先阅读更改内容因为系统可能想要卸载一些软件包,而这可能不是您想要做的):

sudo apt install python3-distutils python3-gdbm python3-lib2to3 python3-tk

现在,如果您遇到了不可能的情况,或者依赖关系存在问题,请编辑您的问题并发布错误。谢谢!


更新

运行以下命令查看安装了哪个版本的python3,然后再次尝试安装:

sudo apt install python3
sudo apt install python3-distutils python3-gdbm python3-lib2to3 python3-tk

如果您仍然遇到问题,那是因为您使用的 ppa 或额外存储库尚未发布所需的 python3 版本。很有可能,额外版本很快就会发布。

相关内容