【问题标题】:pip install requests errorpip 安装请求错误
【发布时间】:2017-07-28 16:08:27
【问题描述】:

尝试安装请求,收到以下错误消息。我还尝试手动下载它们并根据本地文件运行相同的代码,但我遇到了同样的问题。我不认为它在请求方面,因为如果我尝试通过 pip 下载任何内容,我会收到相同的错误消息。

C:\Users\212615669>pip install requests
Collecting requests
  Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connec
tion broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.conne
ction.VerifiedHTTPSConnection object at 0x031251D0>: Failed to establish a new c
onnection: [Errno 11004] getaddrinfo failed',)': /simple/requests/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connec
tion broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.conne
ction.VerifiedHTTPSConnection object at 0x03125190>: Failed to establish a new c
onnection: [Errno 11004] getaddrinfo failed',)': /simple/requests/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connec
tion broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.conne
ction.VerifiedHTTPSConnection object at 0x03125090>: Failed to establish a new c
onnection: [Errno 11004] getaddrinfo failed',)': /simple/requests/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connec
tion broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.conne
ction.VerifiedHTTPSConnection object at 0x03121FD0>: Failed to establish a new c
onnection: [Errno 11004] getaddrinfo failed',)': /simple/requests/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connec
tion broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.conne
ction.VerifiedHTTPSConnection object at 0x03121EB0>: Failed to establish a new c
onnection: [Errno 11004] getaddrinfo failed',)': /simple/requests/
  Could not find a version that satisfies the requirement requests (from version
s: )
No matching distribution found for requests

【问题讨论】:

  • 这个错误是关于互联网连接而不是请求库安装
  • 他们正在使用代理

标签: python installation pip python-requests


【解决方案1】:
sudo -H pip install requests --proxy="my_proxy_name:port"

试试这个

【讨论】:

【解决方案2】:

简单的方法是提供代理信息。

 pip install --proxy=user:pass@server:port requests

第二种方法是使用导出代理设置

set http_proxy=http://username:password@proxyAddress:port
set https_proxy=https://username:password@proxyAddress:port
pip install requests

【讨论】:

  • 等等,我如何获取我的代理信息?那是我放 localhost 之类的地方吗?
  • 我在查找代理信息时遇到了很多麻烦(类似于该线程上的其他用户,我不直接控制我的网络)。你知道有什么其他的下载方式吗?我有下载的文件的 zip,我相信它包含所有内容
【解决方案3】:

这发生在我启动的开发 Vagrant 虚拟机上(即在互联网关闭时通过vagrant up。我猜,它重新启动后,网络设置从未更新。

我所要做的就是停止虚拟机并重新启动它。问题消失了。

也许这对某人有帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-07-07
    • 1970-01-01
    • 1970-01-01
    • 2018-12-06
    相关资源
    最近更新 更多