这次的问题是这样出现的,在安装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条命令即可完成修复。