這次的問題是這樣出現的,在安裝pip install openpyxl
的時候,顯示warning,WARNING: You are using pip version 20.1; however, version 20.1.1 is available
於是,輸入了pip install --upgrade pip
進行了更新,結果出現了以下報錯 ERROR: Could not install packages due to an EnvironmentError: [WinError 5] 拒絕訪問。: 'd:\\pip.exe' Consider using the --user option or check the permissions
後續就沒有了這個module No module named 'pip'
那麼如何修復呢?
python -m ensurepip
python -m pip install --upgrade pip
當在執行pip更新時,出現失敗或警告,再次執行pip命令報錯時,分別按順序執行以上2條命令即可完成修復。