通过代理pip安装软件包

时间:2018-08-17 09:48:06

标签: python pip

我尝试使用proxy点安装,代理设置正确,因为它适用于npm install。我尝试的是如下所示,但收到错误消息。任何想法都将受到欢迎!

set http_proxy=http://<username>:<password>@<proxy_server>:<port>

set https_proxy=https://<username>:<password>@<proxy_server>:<port>

pip install Flask

Collecting Flask
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required'))': /simple/flask/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required'))': /simple/flask/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required'))': /simple/flask/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required'))': /simple/flask/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required'))': /simple/flask/
  Could not find a version that satisfies the requirement Flask (from versions: )
No matching distribution found for Flask

3 个答案:

答案 0 :(得分:1)

https://stackoverflow.com/a/33611028/2653663看来应该是

set https_proxy=<domain><username>:<password>@<proxy_server>:<port>

所以端口而不是IP。

答案 1 :(得分:1)

pip install packageName --proxy proxy_Server:portnumber

ex: pip install numpy --proxy https://myproxy@myserver.com:9090

答案 2 :(得分:0)

set http_proxy=...set https_proxy=...。如果代理有效,应该就足够了。

请运行以下命令以确保其正常工作:

curl https://google.com

enter image description here