如何使用 chocolatey 安装软件包的最新补丁版本?

如何使用 chocolatey 安装软件包的最新补丁版本?

我需要 Python 3.8,所以我决定使用巧克力味

我发现有很多:

> choco list python3 -e --all

Chocolatey v0.12.1
python3 3.10.2 [Approved]
python3 3.10.1 [Approved]
python3 3.10.0 [Approved]
python3 3.9.10 [Approved]
[...]
python 3.9.0 [Approved]
python 3.8.10 [Approved]
python 3.8.9 [Approved]
python 3.8.8 [Approved]
[...]

为了测试,我选择了 3.8.9,看看是否可以升级:

> choco install python -e --version 3.8.9

安装过程很顺利,按预期完成。现在我想要最新的 3.8,也就是 3.8.10,但是:

> choco upgrade python --noop

说它将安装 3.10.2:

Chocolatey v0.12.1
_ Chocolatey:ChocolateyUpgradeCommand - Noop Mode _

You have python v3.8.9 installed. Version 3.10.2 is available based on your source(s).

Chocolatey can upgrade 1/1 packages.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Did you know the proceeds of Pro (and some proceeds from other
 licensed editions) go into bettering the community infrastructure?
 Your support ensures an active community, keeps Chocolatey tip-top,
 plus it nets you some awesome features!
 https://chocolatey.org/compare

我无法找到如何表达“最新的 3.8”:

> choco upgrade python --noop --version 3.8

Chocolatey v0.12.1
_ Chocolatey:ChocolateyUpgradeCommand - Noop Mode _
A newer version of python (v3.8.9) is already installed.
 Use --allow-downgrade or --force to attempt to upgrade to older versions, or use side by side to allow multiple versions.

Chocolatey can upgrade 0/1 packages. 1 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures
 - python - A newer version of python (v3.8.9) is already installed.
 Use --allow-downgrade or --force to attempt to upgrade to older versions, or use side by side to allow multiple versions.

或者

> choco upgrade python --noop --version 3.8.x

Chocolatey v0.12.1
_ Chocolatey:ChocolateyUpgradeCommand - Noop Mode _
'3.8.x' is not a valid version string.
Nome parametro: version

答案1

在我使用 choco 安装 3.9.0 后,我也遇到了类似的难题。安装后不久,我意识到实际上有 3.9.12 可用,我无法弄清楚如何在不跳转到 3.10.4 的情况下使用 choco 进行更新/升级,因为它在运行后威胁要这样做:

choco upgrade python --what-if

所以我这样做了:

choco install python --version=3.9.12

到目前为止一切看上去都很好……

相关内容