最近,我使用安裝了Python 3.8巧克力口味透過Windows PowerShell在Windows 10。成功並新增了一個新資料夾 C:\Python38。
但是,我想降級到較低版本的 Python,因此我透過執行以下命令卸載了 Python:
choco uninstall python
並且也刪除了Python38資料夾。
然後,我嘗試透過運行安裝 Python 3.7
choco install python
這給了我以下內容
Chocolatey v0.10.15
Installing the following packages:
python
By installing you accept licenses for the packages.
Progress: Downloading python 3.7.3... 100%
python3 v3.7.3 [Approved]
python3 package files install completed. Performing other installation steps.
Installing 64-bit python3...
python3 has been installed.
Installed to: 'C:\Python37'
The install of python3 was successful.
Software installed as 'exe', install location is likely default.
python v3.7.3 [Approved]
python package files install completed. Performing other installation steps.
The install of python was successful.
Software install location not explicitly set, could be in package or
default install location if installer.
Chocolatey installed 2/2 packages.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
然而,檢查我的系統,沒有C:\Python37
.透過搜尋我的系統,我找不到任何證據表明安裝過程確實將新的 Python 檔案添加到了我的系統中。
作為測試,我還嘗試使用 Chocolatey 重新安裝 Python 3.8,雖然安裝顯示安裝成功Installed to: 'C:\Python38'
,但它實際上從未出現在我的硬碟上。
答案1
我遇到了同樣的問題,我透過刪除資料夾解決了這個問題:
C:\ProgramData\chocolatey\lib\python
C:\ProgramData\chocolatey\lib\python3
只有刪除這個資料夾後,choco 才會真正安裝 python(這個過程需要更長的時間)。