pip在我的主机中安装库时的问题

时间:2018-03-29 10:48:19

标签: python pip

我试图在我的macosx(python 2.7.10)中使用pip(9.0.1)但是每当我安装一些东西时我都会遇到这些错误:

Collecting flask
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10b8fa310>: Failed to establish a new connection: [Errno 61] Connection refused',)': /simple/flask/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10b8fa110>: Failed to establish a new connection: [Errno 61] Connection refused',)': /simple/flask/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10b8fa550>: Failed to establish a new connection: [Errno 61] Connection refused',)': /simple/flask/
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10b8fa850>: Failed to establish a new connection: [Errno 61] Connection refused',)': /simple/flask/
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10b8facd0>: Failed to establish a new connection: [Errno 61] Connection refused',)': /simple/flask/

有些人提到可能与防火墙有关,所以我通过手机连接到网络,然后我执行pip,在这种情况下,似乎安装了东西,但我仍然得到所有这些“重试”,然后下载每个包像:

Collecting flask
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10b8fa310>: Failed to establish a new connection: [Errno 61] Connection refused',)': /simple/flask/
Retrying (Retry(total=3, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10b8fa110>: Failed to establish a new connection: [Errno 61] Connection refused',)': /simple/flask/
Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10b8fa550>: Failed to establish a new connection: [Errno 61] Connection refused',)': /simple/flask/
Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10b8fa850>: Failed to establish a new connection: [Errno 61] Connection refused',)': /simple/flask/
Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connection broken by 'NewConnectionError('<pip._vendor.requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x10b8facd0>: Failed to establish a new connection: [Errno 61] Connection refused',)': /simple/flask/ 
Downloading Flask-0.12.2-py2.py3-none-any.whl (83kB)
100% |████████████████████████████████| 92kB 1.8MB/s 
Collecting itsdangerous>=0.21 (from flask)
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by '

我知道为什么会收到这些消息?

1 个答案:

答案 0 :(得分:0)

pip有proxy选项。请使用它。

pip install flask --proxy=<proxy address>

来自pip --help

  

- proxy以[user:passwd @] proxy.server:port。

的形式指定代理

了解代理地址here

请参考this在mac os上设置代理。