免互動安裝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