apt 拒绝安装更新版本的软件包

Aez*_*ace 1 debian apt

我正在尝试安装 Python 3.9,但 Debian 带有 3.7。

当我运行时sudo apt install python3.9,我收到以下信息:

E: Unable to locate package python3.9
E: Couldn't find any package by glob 'python3.9'
E: Couldn't find any package by regex 'python3.9'
Run Code Online (Sandbox Code Playgroud)

当我运行时sudo apt install python3,我得到这个:

python3 is already the newest version (3.7.3-1).
Run Code Online (Sandbox Code Playgroud)

我手动去了,发现事实上 Debian 的服务器上有 Python 3.9。它位于这里

然后我下载了debPython 3.9的文件并运行sudo apt install ./python3.9*,结果如下:

Note, selecting 'python3.9' instead of './python3.9_3.9.6-1_i386.deb'
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.9 : Depends: python3.9-minimal (= 3.9.6-1) but it is not installable
             Depends: libpython3.9-stdlib (= 3.9.6-1) but it is not installable
E: Unable to correct problems, you have held broken packages.
Run Code Online (Sandbox Code Playgroud)

然后我下载了deb这两个的文件并尝试了同样的事情,但最终得到了更多“不可安装”的依赖项。

我知道您无法安装未针对我正在运行的 Debian 版本配置的软件包,但是有没有办法安装 Python 3.9?有没有办法在不从源代码构建的情况下安装它?

我正在buster使用 i386(32 位)架构运行 Debian 10.10 ( )。

我的sources.list(我使用的是澳大利亚镜像):

deb http://ftp.au.debian.org/debian/ buster main
deb-src http://ftp.au.debian.org/debian/ buster main

deb http://ftp.au.debian.org/debian/ buster/updates main
deb-src http://ftp.au.debian.org/debian/ buster/updates main

# buster-updates, previously known as 'volatile'
# deb http://ftp.au.debian.org/debian/ buster-updates main
# deb-src http://ftp.au.debian.org/debian/ buster-updates main
Run Code Online (Sandbox Code Playgroud)

Ste*_*art 10

您可以从Debian 的跟踪器中看到:

  • Debian 9 ( stretch/ oldstable) 随 3.5.3 一起提供
  • Debian 10 ( buster/ stable) 附带 3.7.3
  • Debian 11 ( bullseye/ testing) 将随 3.9.2 一起提供
  • experimental 有 3.9.4
  • python3 不可用 stable-backports

bullseye将在几周内发布。如果您执行dist-upgradeto bullseye,您将获得 python3.9。这是你能做的最安全的事情。

可以添加experimental到您的souces.list, 然后sudo apt install -t experimental python3,但是您正在替换一个非常核心的包,如果事情进展不顺利,它具有一些危险的潜力。

另请注意:如果您使用的是 Debian 10,则所有本机软件包都可以使用 python3.7。除非您自己编写 Python 代码并且您专门尝试使用较新版本提供的功能,否则几乎没有理由升级。如果您依赖pip软件包,那么大多数软件包都可python3-<pkg>用于 debian 10 中的 python3.7。

  • 关于。实验性的,实验性的包适用于不稳定的,所以将它们与测试或稳定混合通常不是一个好主意(除非一个人有足够的知识来自己解决问题)。对于开发,virtualenvs 允许使用任何版本的 Python。 (2认同)