免互動安裝Python 3.7、解除安裝,以及在部署工具中偵測安裝狀態所用的指令。只列出確定可用的指令:來自資訊清單,或是安裝程式技術的官方預設參數。
相關教學: 靜默安裝參數總整理:MSI、NSIS、Inno Setup · 用登錄檔或PowerShell解除安裝程式
使用winget
PowerShell
winget install --id Python.Python.3.7 -e --silent --accept-package-agreements --accept-source-agreementswinget upgrade --id Python.Python.3.7 -e --silentwinget uninstall --id Python.Python.3.7 -e --silent依安裝檔
64位元 · EXE(WiX Burn) · 僅目前使用者
靜默安裝
python-3.7.9-amd64.exe /quiet /norestart解除安裝
msiexec /x {9DF6F8E6-72F4-474F-A929-37485BB7537E} /qn /norestart- MSI產品代碼
- {9df6f8e6-72f4-474f-a929-37485bb7537e}
- 解除安裝登錄機碼
- HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{9df6f8e6-72f4-474f-a929-37485bb7537e}
- UpgradeCode
- {71010FC2-A70A-5D7A-AA83-DC4282DCFE02}
- DisplayVersion
- 3.7.9150.0
64位元 · EXE(WiX Burn) · 所有使用者
靜默安裝
python-3.7.9-amd64.exe /quiet /norestart解除安裝
msiexec /x {9DF6F8E6-72F4-474F-A929-37485BB7537E} /qn /norestart- MSI產品代碼
- {9df6f8e6-72f4-474f-a929-37485bb7537e}
- 解除安裝登錄機碼
- HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{9df6f8e6-72f4-474f-a929-37485bb7537e}
- UpgradeCode
- {71010FC2-A70A-5D7A-AA83-DC4282DCFE02}
- DisplayVersion
- 3.7.9150.0
32位元 · EXE(WiX Burn) · 僅目前使用者
靜默安裝
python-3.7.9.exe /quiet /norestart解除安裝
msiexec /x {D0F4B802-4C35-43A7-B0B9-F1CBDB3675EC} /qn /norestart- MSI產品代碼
- {d0f4b802-4c35-43a7-b0b9-f1cbdb3675ec}
- 解除安裝登錄機碼
- HKCU\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{d0f4b802-4c35-43a7-b0b9-f1cbdb3675ec}
- UpgradeCode
- {5C464E87-58D7-5592-B004-12ED93D23716}
- DisplayVersion
- 3.7.9150.0
32位元 · EXE(WiX Burn) · 所有使用者
靜默安裝
python-3.7.9.exe /quiet /norestart解除安裝
msiexec /x {D0F4B802-4C35-43A7-B0B9-F1CBDB3675EC} /qn /norestart- MSI產品代碼
- {d0f4b802-4c35-43a7-b0b9-f1cbdb3675ec}
- 解除安裝登錄機碼
- HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{d0f4b802-4c35-43a7-b0b9-f1cbdb3675ec}
- UpgradeCode
- {5C464E87-58D7-5592-B004-12ED93D23716}
- DisplayVersion
- 3.7.9150.0
PowerShell:下載、驗證、安裝
下載官方檔案,驗證SHA256後靜默安裝。
install-python-3-7.ps1
$url = 'https://www.python.org/ftp/python/3.7.9/python-3.7.9-amd64.exe'
$sha256 = 'E69ED52AFB5A722E5C56F6C21D594E85C17CB29F12F18BB69751CF1714E0F987'
$file = Join-Path $env:TEMP 'python-3.7.9-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-7.ps1
$url = 'https://www.python.org/ftp/python/3.7.9/python-3.7.9-amd64.exe'
$sha256 = 'E69ED52AFB5A722E5C56F6C21D594E85C17CB29F12F18BB69751CF1714E0F987'
$file = Join-Path $env:TEMP 'python-3.7.9-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-7.ps1
$url = 'https://www.python.org/ftp/python/3.7.9/python-3.7.9.exe'
$sha256 = '769BB7C74AD1DF6D7D74071CC16A984FF6182E4016E11B8949B93DB487977220'
$file = Join-Path $env:TEMP 'python-3.7.9.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-7.ps1
$url = 'https://www.python.org/ftp/python/3.7.9/python-3.7.9.exe'
$sha256 = '769BB7C74AD1DF6D7D74071CC16A984FF6182E4016E11B8949B93DB487977220'
$file = Join-Path $env:TEMP 'python-3.7.9.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