用于免交互安装Python 3.5、卸载以及在部署工具中检测安装状态的命令。只列出确定可用的命令:来自清单文件,或来自安装程序技术的官方默认参数。
相关教程: 静默安装参数大全:MSI、NSIS、Inno Setup · 用注册表或PowerShell卸载程序
使用winget
PowerShell
winget install --id Python.Python.3.5 -e --silent --accept-package-agreements --accept-source-agreementswinget upgrade --id Python.Python.3.5 -e --silentwinget uninstall --id Python.Python.3.5 -e --silent按安装包
64位 · EXE(WiX Burn) · 仅当前用户
静默安装
python-3.5.4-amd64.exe /quiet /norestart卸载
msiexec /x {5D57524F-AF24-49A7-B90B-92138880481E} /qn /norestart- MSI产品代码
- {5d57524f-af24-49a7-b90b-92138880481e}
- 卸载注册表项
- HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5d57524f-af24-49a7-b90b-92138880481e}
- UpgradeCode
- {EEB42FF5-6DC6-5D71-9D60-792E37FA8953}
- DisplayVersion
- 3.5.4150.0
64位 · EXE(WiX Burn) · 所有用户
静默安装
python-3.5.4-amd64.exe /quiet /norestart卸载
msiexec /x {5D57524F-AF24-49A7-B90B-92138880481E} /qn /norestart- MSI产品代码
- {5d57524f-af24-49a7-b90b-92138880481e}
- 卸载注册表项
- HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{5d57524f-af24-49a7-b90b-92138880481e}
- UpgradeCode
- {EEB42FF5-6DC6-5D71-9D60-792E37FA8953}
- DisplayVersion
- 3.5.4150.0
32位 · EXE(WiX Burn) · 仅当前用户
静默安装
python-3.5.4.exe /quiet /norestart卸载
msiexec /x {06E841FA-CA3B-4886-A820-CD32C614B0C1} /qn /norestart- MSI产品代码
- {06e841fa-ca3b-4886-a820-cd32c614b0c1}
- 卸载注册表项
- HKCU\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{06e841fa-ca3b-4886-a820-cd32c614b0c1}
- UpgradeCode
- {3A1A27C0-4578-514F-9380-81D44B2F03AB}
- DisplayVersion
- 3.5.4150.0
32位 · EXE(WiX Burn) · 所有用户
静默安装
python-3.5.4.exe /quiet /norestart卸载
msiexec /x {06E841FA-CA3B-4886-A820-CD32C614B0C1} /qn /norestart- MSI产品代码
- {06e841fa-ca3b-4886-a820-cd32c614b0c1}
- 卸载注册表项
- HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{06e841fa-ca3b-4886-a820-cd32c614b0c1}
- UpgradeCode
- {3A1A27C0-4578-514F-9380-81D44B2F03AB}
- DisplayVersion
- 3.5.4150.0
PowerShell:下载、校验、安装
下载官方文件,校验SHA256后静默安装。
install-python-3-5.ps1
$url = 'https://www.python.org/ftp/python/3.5.4/python-3.5.4-amd64.exe'
$sha256 = '9B7741CC32357573A77D2EE64987717E527628C38FD7EAF3E2AACA853D45A1EE'
$file = Join-Path $env:TEMP 'python-3.5.4-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-5.ps1
$url = 'https://www.python.org/ftp/python/3.5.4/python-3.5.4-amd64.exe'
$sha256 = '9B7741CC32357573A77D2EE64987717E527628C38FD7EAF3E2AACA853D45A1EE'
$file = Join-Path $env:TEMP 'python-3.5.4-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-5.ps1
$url = 'https://www.python.org/ftp/python/3.5.4/python-3.5.4.exe'
$sha256 = 'F27C2D67FD9688E4970F3BFF799BB9D722A0D6C2C13B04848E1F7D620B524B0E'
$file = Join-Path $env:TEMP 'python-3.5.4.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-5.ps1
$url = 'https://www.python.org/ftp/python/3.5.4/python-3.5.4.exe'
$sha256 = 'F27C2D67FD9688E4970F3BFF799BB9D722A0D6C2C13B04848E1F7D620B524B0E'
$file = Join-Path $env:TEMP 'python-3.5.4.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