用于免交互安装Python 3.8、卸载以及在部署工具中检测安装状态的命令。只列出确定可用的命令:来自清单文件,或来自安装程序技术的官方默认参数。
相关教程: 静默安装参数大全:MSI、NSIS、Inno Setup · 用注册表或PowerShell卸载程序
使用winget
PowerShell
winget install --id Python.Python.3.8 -e --silent --accept-package-agreements --accept-source-agreementswinget upgrade --id Python.Python.3.8 -e --silentwinget uninstall --id Python.Python.3.8 -e --silent按安装包
64位 · EXE(WiX Burn) · 仅当前用户
静默安装
python-3.8.10-amd64.exe /quiet /norestart卸载
msiexec /x {E9CD241B-9125-4624-9625-FF42D2F3647F} /qn /norestart- MSI产品代码
- {e9cd241b-9125-4624-9625-ff42d2f3647f}
- 卸载注册表项
- HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{e9cd241b-9125-4624-9625-ff42d2f3647f}
- UpgradeCode
- {6D2E28EF-5AEA-5A3E-B7B4-7E3B246D9DA8}
- DisplayVersion
- 3.8.10150.0
64位 · EXE(WiX Burn) · 所有用户
静默安装
python-3.8.10-amd64.exe /quiet /norestart卸载
msiexec /x {E9CD241B-9125-4624-9625-FF42D2F3647F} /qn /norestart- MSI产品代码
- {e9cd241b-9125-4624-9625-ff42d2f3647f}
- 卸载注册表项
- HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{e9cd241b-9125-4624-9625-ff42d2f3647f}
- UpgradeCode
- {6D2E28EF-5AEA-5A3E-B7B4-7E3B246D9DA8}
- DisplayVersion
- 3.8.10150.0
32位 · EXE(WiX Burn) · 仅当前用户
静默安装
python-3.8.10.exe /quiet /norestart卸载
msiexec /x {85379532-0003-4517-8FC4-6227B410C30C} /qn /norestart- MSI产品代码
- {85379532-0003-4517-8fc4-6227b410c30c}
- 卸载注册表项
- HKCU\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{85379532-0003-4517-8fc4-6227b410c30c}
- UpgradeCode
- {7F7CEC53-74A3-5306-8929-AAEFBED71FF3}
- DisplayVersion
- 3.8.10150.0
32位 · EXE(WiX Burn) · 所有用户
静默安装
python-3.8.10.exe /quiet /norestart卸载
msiexec /x {85379532-0003-4517-8FC4-6227B410C30C} /qn /norestart- MSI产品代码
- {85379532-0003-4517-8fc4-6227b410c30c}
- 卸载注册表项
- HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{85379532-0003-4517-8fc4-6227b410c30c}
- UpgradeCode
- {7F7CEC53-74A3-5306-8929-AAEFBED71FF3}
- DisplayVersion
- 3.8.10150.0
PowerShell:下载、校验、安装
下载官方文件,校验SHA256后静默安装。
install-python-3-8.ps1
$url = 'https://www.python.org/ftp/python/3.8.10/python-3.8.10-amd64.exe'
$sha256 = '7628244CB53408B50639D2C1287C659F4E29D3DFDB9084B11AED5870C0C6A48A'
$file = Join-Path $env:TEMP 'python-3.8.10-amd64.exe'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Start-Process -FilePath $file -ArgumentList '/quiet /norestart' -Wait install-python-3-8.ps1
$url = 'https://www.python.org/ftp/python/3.8.10/python-3.8.10-amd64.exe'
$sha256 = '7628244CB53408B50639D2C1287C659F4E29D3DFDB9084B11AED5870C0C6A48A'
$file = Join-Path $env:TEMP 'python-3.8.10-amd64.exe'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Start-Process -FilePath $file -ArgumentList '/quiet /norestart' -Wait install-python-3-8.ps1
$url = 'https://www.python.org/ftp/python/3.8.10/python-3.8.10.exe'
$sha256 = 'AD07633A1F0CD795F3BF9DA33729F662281DF196B4567FA795829F3BB38A30AC'
$file = Join-Path $env:TEMP 'python-3.8.10.exe'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Start-Process -FilePath $file -ArgumentList '/quiet /norestart' -Wait install-python-3-8.ps1
$url = 'https://www.python.org/ftp/python/3.8.10/python-3.8.10.exe'
$sha256 = 'AD07633A1F0CD795F3BF9DA33729F662281DF196B4567FA795829F3BB38A30AC'
$file = Join-Path $env:TEMP 'python-3.8.10.exe'
Invoke-WebRequest -Uri $url -OutFile $file -UseBasicParsing
if ((Get-FileHash $file -Algorithm SHA256).Hash -ne $sha256) { throw 'SHA256 mismatch' }
Start-Process -FilePath $file -ArgumentList '/quiet /norestart' -Wait