安装pip时出现连接错误

4

我正在尝试使用pip安装名为gmplot的库。在我的Mac上这很顺利,但在我的Windows 10机器上却不行。我遇到了以下错误:

C:\Users\Alex>pip install gmplot
Collecting gmplot
  Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000000003BD70B8>: Failed to establish a new connection: [Errno 11003] getaddrinfo failed',)': /simple/gmplot/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000000003BD7A58>: Failed to establish a new connection: [Errno 11003] getaddrinfo failed',)': /simple/gmplot/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000000003BD7DA0>: Failed to establish a new connection: [Errno 11003] getaddrinfo failed',)': /simple/gmplot/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000000003BD75C0>: Failed to establish a new connection: [Errno 11003] getaddrinfo failed',)': /simple/gmplot/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000000003BD7D30>: Failed to establish a new connection: [Errno 11003] getaddrinfo failed',)': /simple/gmplot/
  Could not find a version that satisfies the requirement gmplot (from versions: )
No matching distribution found for gmplot

其他stackoverflow线程提到在pip命令中添加代理详细信息,但我不使用代理。我也将我的DNS更改为Google的DNS,但这并没有起作用。

(Python 2.7)


3
为了好玩,我尝试了这个方法,它有效。你没有提到你的互联网设置。解决这个问题的一种方法是到另一台安装有相同Python版本的Windows 10机器上,然后输入“pip download gmplot”。你可以将下载的文件移动到你的计算机上的一个目录中,并在那里输入“pip install gmplot --no-index --find-links . ”。这就是我在没有互联网的计算机上安装pip下载的方法... - 576i
谢谢。关于我的互联网设置,我不知道该说什么。只是一个普通的家庭宽带/ WiFi 连接,没有代理,没有 VPN,在访问互联网的任何部分时都没有问题,除了上述情况。不幸的是,我没有另一台 Windows 机器,但在最坏的情况下,我会找到一台。 - Alexis Eggermont
1
你可能需要将Python升级到当前版本(3.6.1),或者升级pip,然后重试... - 576i
可能与https://dev59.com/b1_Va4cB1Zd3GeqPTXTT有关; 那里的问题是代理设置。 - user707650
1
谢谢,但我不使用代理。我检查了我的设置,确认这是事实。 - Alexis Eggermont
可能是使用pip时的代理意识问题的重复。 - craq
1个回答

0
对我来说,解决方案是在根目录的 .bash_profile 中设置代理。如果没有该文件,请创建它。
例如:
export http_proxy=
这是在连接到虚拟机上的互联网的Centos系统上完成的。

1
http_proxy变量应该设置为什么? - Kris10an
是的,但这是在虚拟机上,所以似乎不适用于这个问题。 - dawid

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