报错描述
在 windows 系统终端命令窗口中用 pip 指令安装包时报错,需要升级 pip 来解决问题。在执行 pip install --upgrade pip 后,报出如下错误:
C:\Users\Administrator>pip install --upgrade pip
Collecting pip
Using cached https://files.pythonhosted.org/packages/8a/6a/19e9fe04fca059ccf770861c7d5721ab4c2aebc539889e97c7977528a53b/pip-24.0-py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 19.2.3
Uninstalling pip-19.2.3:
ERROR: Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问。: 'd:\python37\scripts\pip.exe'
Consider using the --user
option or check the permissions.
解决方法
1、输入如下修复代码:
python -m ensurepip
2、重新更新升级 pip:
python -m pip install --upgrade pip
文献来源:https://blog.csdn.net/qq_42711123/article/details/130565432