Python警告:正在重试(重试(总数=4,连接=无,读取=无,重定向=无,状态=无)



我正在尝试执行pip install --upgrade pip并不断收到此错误:

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnection
Error('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000026F50B448C8>: Failed to establish a new connection: [WinError 10061] No connection could be made
because the target machine actively refused it'))': /simple/pytest/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnection
Error('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000026F50B59148>: Failed to establish a new connection: [WinError 10061] No connection could be made
because the target machine actively refused it'))': /simple/pytest/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnection
Error('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000026F50B596C8>: Failed to establish a new connection: [WinError 10061] No connection could be made
because the target machine actively refused it'))': /simple/pytest/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnection
Error('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000026F50B595C8>: Failed to establish a new connection: [WinError 10061] No connection could be made
because the target machine actively refused it'))': /simple/pytest/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', NewConnection
Error('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x0000026F50B5F2C8>: Failed to establish a new connection: [WinError 10061] No connection could be made
because the target machine actively refused it'))': /simple/pytest/
ERROR: Could not find a version that satisfies the requirement pytest
ERROR: No matching distribution found for pytest

此外,由于这个错误,我无法安装任何新的软件包
我试着重新安装Pycharm,但没有成功
我在网上尝试了一些其他建议的解决方案,但仍然没有成功
我知道这与Proxy有关,但我不熟悉,有人吗?

尝试在构建命令中添加--network=host
例如:docker build -t cointainer_name . --network=host

If you use the host network mode for a container, that container’s network stack is not isolated from the 
Docker host (the container shares the host’s networking namespace), and the container does not 
get its own IP-address allocated. 
For instance, if you run a container which binds to port 80 and you use host 
networking, the container’s application is available on port 80 on the host’s IP address.

点击此处查看更多详细信息

首先,重新安装所有python。其次,一旦安装了python,我就去找主机文件,并取消对主机部分的注释。通常,windows中的路径位于C:\windows\System32\drivers\etc 中

取消注释本节:

localhost名称解析是在DNS本身中处理的

127.0.0.1       localhost
::1             localhost

希望它有用!干杯

TL;适用于Windows的DR,这对我有效

  1. Windows+I(打开"设置"(
  2. 选择Network & Internet
  3. 选择Proxy
  4. 检查Manual proxy setup是否处于Off-位置

---这里已经开始工作了---

  1. 注意:Automatically detect settings切换到OnOff对我没有影响(所有这些仍然可以继续工作,因为它在4之后开始工作。(

故事简介

我也有同样的错误。无法通过pippipenv、anaconda和PyCharm安装库。然后我检查了Proxy设置(Windows 11操作系统(,发现我定义了一些Manual proxy setup。当禁用它时,问题就解决了。

问题很自然地开始了:我做了一些python工作,安装了一些(可能是一些带有pipenv的内核模块,比如笔记本电脑或jupyter实验室、cygwin工具等(,然后安装/更新python模块就崩溃了。也许某些安装更改了代理参数?我不知道
Python重新安装没有帮助。

错误示例

例如,安装/更新时出现的anaconda错误如下:

CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/main/win-64/current_repodata.json>
Elapsed: -
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
If your current network has https://www.anaconda.com blocked, please file
a support request with your network engineering team.
'https://repo.anaconda.com/pkgs/main/win-64'

安装/更新时的Pip错误看起来像:

pip install --upgrade pip
>>>
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /simple/pip/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /simple/pip/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /simple/pip/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /simple/pip/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', FileNotFoundError(2, 'No such file or directory'))': /simple/pip/

我的环境

  • 蟒蛇3.8
  • windows10+WSL
  • 管道21.0.4

我的步骤是什么

  1. conda create -n py38 python=3.8
  2. pip install pandas

然后我得到了那个错误";警告,重试">

我如何解决问题

只要重新启动我的机器

winget install -id Microsoft.Powershell --source winget
winget install -id Microsoft.Powershell.Preview --source winget 

在PowerShell中输入以上命令,然后关闭Pycharm环境,然后再次启动它。安装pip对我来说很有效。

my.bash_profile具有:

export SSLKEYLOGFILE=/Users/X/sslkeylog.log

删除SSLKEYLOGFILE定义修复了该问题。Python 3.8+似乎添加了对SSL密钥日志记录的支持,但它在某种程度上导致了问题。

如果您在公司网络或VPN中,您可能有权访问这些包,断开与这些网络的连接并连接到正常网络,甚至您手机的热点应该可以解决这个问题。

首先转到settings => network&proxy => proxy并将手动代理设置设置为关闭。然后确保您的互联网连接正常,并且没有连接到任何VPN。

如果在安装pip后,您在使用python 3.10 的窗口上出现这样的错误

警告:正在重试(重试(总数=4,连接=无,读取=无,redirect=无,status=无(('ProtocolError('连接中止。',PermissionError(13,'权限拒绝"(":/ssimple/pip/

尝试更新windows(OS(环境变量。关闭窗口用户会话,然后重新输入。它对我有用。

确保您没有连接到VPN连接

相关内容

  • 没有找到相关文章

最新更新