首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >winget能安装更老版本的Python吗?

winget能安装更老版本的Python吗?
EN

Stack Overflow用户
提问于 2021-12-08 20:07:11
回答 3查看 3.2K关注 0票数 5

目前,通过winget提供的最新Python 3是3.10.150.0:

代码语言:javascript
运行
复制
Name                                                Id                                 Version      Match                   Source
-----------------------------------------------------------------------------------------------------------------------------------
Python 3                                            Python.Python.3                    3.10.150.0   Command: python         winget

但是我想安装3.9并继续使用3.9。有可能和winget一起做吗?

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2021-12-09 17:13:57

代码语言:javascript
运行
复制
winget install -e --id Python.Python -v 3.9.0
票数 6
EN

Stack Overflow用户

发布于 2022-08-22 07:35:36

首先,您可以通过以下命令看到所有可用的版本:

代码语言:javascript
运行
复制
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,这也允许包管理器在出现补丁时更新它。

代码语言:javascript
运行
复制
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对安装进行微调,如下所示。

代码语言:javascript
运行
复制
PS C:\dev> winget install -i Python.Python.3.9
票数 1
EN

Stack Overflow用户

发布于 2022-06-06 18:45:03

在Windows11中,我在这个站点中使用了命令:https://winget.run/pkg/Python/Python.3

要获得3.7.7版本:

代码语言:javascript
运行
复制
winget install -e --id Python.Python.3 -v 3.7.7150.0
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70281103

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档