【问题标题】:PIP install and Python requests get PermissionError on WindowsPIP 安装和 Python 请求在 Windows 上获得 PermissionError
【发布时间】:2022-11-11 06:55:29
【问题描述】:

在互联网上搜索,一个接一个的线程尝试了几乎 2 天的所有解决方案,但找不到解决方案。 我已经尝试重新安装 python 和 pip。

我尝试以管理员身份通过 cmd 运行脚本,但仍然没有。

问题是我不能提出任何其他请求, 无法安装 pip 包,基本上我的 py 是孤立的。

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', PermissionError(13, 'Permission denied'))': /simple/pypdf2/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', PermissionError(13, 'Permission denied'))': /simple/pypdf2/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', PermissionError(13, 'Permission denied'))': /simple/pypdf2/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', PermissionError(13, 'Permission denied'))': /simple/pypdf2/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', PermissionError(13, 'Permission denied'))': /simple/pypdf2/
ERROR: Could not find a version that satisfies the requirement pypdf2 (from versions: none)
ERROR: No matching distribution found for pypdf2

另一个例子, 代码非常简单:

import requests
new_lines = requests.get('https://api...')

我得到的错误是:

  File "C:\Users\OPS\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "C:\Users\OPS\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Users\OPS\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\sessions.py", line 529, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\OPS\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\sessions.py", line 645, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\OPS\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\adapters.py", line 501, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', PermissionError(13, 'Permission denied'))

两者都有:

('Connection aborted.', PermissionError(13, 'Permission denied'))

并且不能发出任何外部请求对于哪个服务器/网络/任何东西都无关紧要。

使用 Windows 10 python 3.10 pip 22.0.4 我已经安装了 docker、WSL2、Chocolatey,它们都进行了某种 powershell 操作。

【问题讨论】:

  • 是的,但是我会遇到导入请求的问题,无法使用 python 提出任何请求……我想从根本上解决问题。

标签: python windows pip permissions


【解决方案1】:

确认这是 python 3.10 - 3.8 中的一个错误 我已经尝试了一切,禁用杀毒软件删除了所有软件。 每个 python 版本都安装在不同的位置, 检查了注册表,检查了powershell权限配置, 这只是python中的错误。 3.10.4、30.10、30.9、30.8 不适合我。 只有 python 3.7.4。 我刚刚降级到 python 3.7.4 并且 pip 像魅力一样工作。 请求模块也很好用,没有任何阻塞。

问题是它是旧版本... 我的很多项目都需要一个更新的项目。 切换到mac,windows是有问题的。

https://bugs.python.org/msg378892

https://github.com/python/cpython/issues/86238

我找到的答案: https://geeksqa.com/pip-install-fails-with-protocolerror-connection-aborted-permissionerror-13-permission-denied

【讨论】:

  • 删除评论并专注于问题的解决方案(答案)。谢谢
猜你喜欢
  • 1970-01-01
  • 2015-07-28
  • 1970-01-01
  • 2018-07-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-01-21
  • 1970-01-01
相关资源
最近更新 更多