python -m pip install -U pip Errno 11004

4

我正在尝试更新pip,但是一直收到以下消息:

H:\>python -m pip install -U pip
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.con
nection.VerifiedHTTPSConnection object at 0x031AF3B0>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',)': /simple/pip/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.con
nection.VerifiedHTTPSConnection object at 0x031AF3D0>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',)': /simple/pip/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.con
nection.VerifiedHTTPSConnection object at 0x031AF110>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',)': /simple/pip/
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.con
nection.VerifiedHTTPSConnection object at 0x031AF0B0>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',)': /simple/pip/
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.con
nection.VerifiedHTTPSConnection object at 0x031AF170>: Failed to establish a new connection: [Errno 11004] getaddrinfo failed',)': /simple/pip/
Requirement already up-to-date: pip in c:\users\a256886\appdata\local\programs\python\python36-32\lib\site-packages

我已经安装了Python 3.6.1,当我运行pip --version时,我看到的是pip 9.0.1版本。

为什么我不能更新它?或者用pip安装任何包?发生了什么?我该如何解决?


9.0.1是pip的最新版本。你为什么要尝试更新它呢? - jwodder
@jwodder 我想安装django。我成功创建了虚拟环境,但是当我尝试安装django pip install django~=1.10.0时,我遇到了相同类型的错误:Could not find a version that satisfies the requirement django~=1.10.0 (from versions: ) No matching distribution found for django~=1.10.0 - G. Doe
@G.Doe:你是在代理服务器后面吗? - user3657941
@DavidCullen 这可能是问题所在吗?我正在尝试在我的工作电脑上安装它。有没有什么办法可以修复它? - G. Doe
1
我已修复!在--proxy命令之前添加http:// username:password@proxy_url:port。 - G. Doe
3个回答

3

您在代理后面。正如您所发现的,您可以使用--proxy参数将代理传递给pip

python -m pip install -U pip --proxy http://username:password@proxy_url:port

或者

pip install --upgrade pip --proxy http://username:password@proxy_url:port

这里的文档很令人困惑,因为它没有提到将协议作为代理定义的一部分传递的要求。


经阅读 https://superuser.com/questions/346372/how-do-i-know-what-proxy-server-im-using 上的每一个回答,我可以很确定地说我没有使用代理。还有其他什么可能导致这个错误吗? - cowlinator

0

我遇到了类似的问题,使用的是Windows系统。我注意到在cmd或终端中,甚至无法ping google.com - 网络似乎正常,我可以通过浏览器访问网站。

重置Winsock目录解决了我的问题:

netsh Winsock reset

0

抱歉回复晚了,但是...

在我的情况下,我使用了一个网络过滤工具(Little Snitch)来保证安全性,这个工具专门阻止从我的终端会话/pip发出的连接。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接