目前,通过winget提供的最新Python 3是3.10.150.0:
Name Id Version Match Source
-----------------------------------------------------------------------------------------------------------------------------------
Python 3 Python.Python.3 3.10.150.0 Command: python winget
但是我想安装3.9并继续使用3.9。有可能和winget一起做吗?
发布于 2021-12-09 17:13:57
winget install -e --id Python.Python -v 3.9.0
发布于 2022-08-22 07:35:36
首先,您可以通过以下命令看到所有可用的版本:
PS C:\dev> winget search Python.Python
Name Id Version Source
---------------------------------------------
Python 3 Python.Python.3.9 3.9.7 winget
Python 3 Python.Python.3.8 3.8.10 winget
Python 3 Python.Python.3.7 3.7.9 winget
Python 3 Python.Python.3.6 3.6.8 winget
Python 3 Python.Python.3.5 3.5.4 winget
Python 3 Python.Python.3.4 3.4.4 winget
Python 3 Python.Python.3.3 3.3.5 winget
Python 3 Python.Python.3.2 3.2.5 winget
Python 3 Python.Python.3.10 3.10.6 winget
Python 3 Python.Python.3.1 3.1.4 winget
Python 3 Python.Python.3.0 3.0.1 winget
Python 2 Python.Python.2 2.7.18150 winget
在您的示例中,最简单的方法是选择所需的Id Python.Python.3.9,这也允许包管理器在出现补丁时更新它。
PS C:\dev> winget install Python.Python.3.9
Found Python 3 [Python.Python.3.9] Version 3.9.7
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Downloading https://www.python.org/ftp/python/3.9.7/python-3.9.7-amd64.exe
██████████████████████████████ 27.5 MB / 27.5 MB
Successfully verified installer hash
Starting package install...
Successfully installed
这将使用默认选项进行自动安装。但是,这种方法的缺点是,每个Python版本都将安装在Python目录树下,比如$LOCALAPPDATA\Programs\Python\Python39
,并且不会对您的路径进行任何更改。
如果您需要所有用户都可以使用Python并自动添加到系统路径,那么最好使用交互式选项-i对安装进行微调,如下所示。
PS C:\dev> winget install -i Python.Python.3.9
发布于 2022-06-06 18:45:03
在Windows11中,我在这个站点中使用了命令:https://winget.run/pkg/Python/Python.3
要获得3.7.7版本:
winget install -e --id Python.Python.3 -v 3.7.7150.0
https://stackoverflow.com/questions/70281103
复制相似问题