ERROR: Could not install packages due to an OSError: [WinError 5] 拒绝访问。

ERROR: Could not install packages due to an OSError: [WinError 5] 拒绝访问。,第1张

今天更新包的时候,提示我要升级pip。于是等升级完,打开PyCharm测试了一下新包的情况,便马不停蹄地更新pip了。

这下可好,应该是升级的时候忘记关PyCharm,导致pip被占用,于是出现以下报错:

ERROR: Could not install packages due to an OSError: [WinError 5] 拒绝访问。: 'd:\python\scripts\pip.exe'

Consider using the `--user` option or check the permissions.

pip install --upgrade pip还是报错,跟之前情况(解决‘pip‘ is a package and cannot be directly executed报错问题和WinError 5]拒绝访问)类似,这一次丝毫不慌。

只不过这一次到d:\python\lib\site-packages,发现已经没有pip相关的两个文件夹了

C:\Users\dell>pip install --upgrade pip
Traceback (most recent call last):
  File "d:\python\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "d:\python\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "D:\Python\Scripts\pip.exe\__main__.py", line 4, in 
ModuleNotFoundError: No module named 'pip'

pip -v也没有反应

C:\Users\dell>pip -v
Traceback (most recent call last):
  File "d:\python\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "d:\python\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "D:\Python\Scripts\pip.exe\__main__.py", line 4, in 
ModuleNotFoundError: No module named 'pip'

 于是直接安装

python -m ensurepip
C:\Users\dell>python -m ensurepip
Looking in links: c:\Users\dell\AppData\Local\Temp\tmp30pelk6f
Requirement already satisfied: setuptools in d:\python\lib\site-packages (51.3.3)
Processing c:\users\dell\appdata\local\temp\tmp30pelk6f\pip-20.2.3-py2.py3-none-any.whl
Installing collected packages: pip
Successfully installed pip-20.2.3

紧接着升级到最新版

python -m pip install --upgrade pip
C:\Users\dell>python -m pip install --upgrade pip
Collecting pip
  Using cached pip-22.0.4-py3-none-any.whl (2.1 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.2.3
    Uninstalling pip-20.2.3:
      Successfully uninstalled pip-20.2.3
Successfully installed pip-22.0.4

Yes! 

生信喵 X CSDN,记录debug的日常。

另外,欢迎大家关注公众号【生信喵】,在那里我会分享机器学习、算法开发的总结笔记……

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/799879.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-06
下一篇 2022-05-06

发表评论

登录后才能评论

评论列表(0条)

保存