目前,通过winget提供的最新Python 3是3.10.150.0:
Name Id Version Match Source
-----------------------------------------------------------------------------------------------------------------------------------
Python 3 Python.Python.3 3.10.150.0 Command: python winget
Run Code Online (Sandbox Code Playgroud)
但我想安装 3.9 并继续使用 3.9。用winget可以做到吗?
Tom*_*ean 16
winget install -e --id Python.Python -v 3.9.0
Run Code Online (Sandbox Code Playgroud)
小智 5
首先,您可以使用以下命令查看所有可用的版本:
\nPS C:\\dev> winget search Python.Python\n\nName Id Version Source\n---------------------------------------------\nPython 3 Python.Python.3.9 3.9.7 winget\nPython 3 Python.Python.3.8 3.8.10 winget\nPython 3 Python.Python.3.7 3.7.9 winget\nPython 3 Python.Python.3.6 3.6.8 winget\nPython 3 Python.Python.3.5 3.5.4 winget\nPython 3 Python.Python.3.4 3.4.4 winget\nPython 3 Python.Python.3.3 3.3.5 winget\nPython 3 Python.Python.3.2 3.2.5 winget\nPython 3 Python.Python.3.10 3.10.6 winget\nPython 3 Python.Python.3.1 3.1.4 winget\nPython 3 Python.Python.3.0 3.0.1 winget\nPython 2 Python.Python.2 2.7.18150 winget\nRun Code Online (Sandbox Code Playgroud)\n对于您的情况,最简单的方法是选择您想要的 Id Python.Python.3.9,这也允许包管理器在补丁发布时更新它。
\nPS C:\\dev> winget install Python.Python.3.9\n\nFound Python 3 [Python.Python.3.9] Version 3.9.7\nThis application is licensed to you by its owner.\nMicrosoft is not responsible for, nor does it grant any licenses to, third-party packages.\nDownloading https://www.python.org/ftp/python/3.9.7/python-3.9.7-amd64.exe\n \xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88\xe2\x96\x88 27.5 MB / 27.5 MB\nSuccessfully verified installer hash\nStarting package install...\nSuccessfully installed\nRun Code Online (Sandbox Code Playgroud)\n这将使用默认选项进行自动安装。但是,这种方法的缺点是每个 Python 版本都将安装在 Python 目录树下,例如$LOCALAPPDATA\\Programs\\Python\\Python39,并且它不会对您的 Path 进行任何更改。
如果您需要 Python 对所有用户可用并自动添加到系统路径中,那么最好使用交互式选项-i来微调安装,如下所示。
\nPS C:\\dev> winget install -i Python.Python.3.9\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
12845 次 |
| 最近记录: |