Configuring PIP to work from behind a proxy

2019-05-10 04:32发布

I've installed python 3.4.3 which comes with pip. I want to use pip from behind a proxy so I did the following:

Created C:\Users\foo\pip\pip.ini and added a proxy configuration section:

[proxy]
export http_proxy=my_proxy_server:1234

However, when I try to run pip to install packages, I get timeout messages:

C:\Users\foo>pip install paramiko Requirement already satisfied (use --upgrade to upgrade): paramiko in c:\python3 4\lib\site-packages\paramiko-1.16.0-py3.4.egg Collecting pycrypto!=2.4,>=2.1 (from paramiko) Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connec tion broken by 'ConnectTimeoutError(, 'Connection to pypi.python. org timed out. (connect timeout=15)')': /simple/pycrypto/

Any ideas what I'm doing wrong?

Thanks in Adv.!

标签: python proxy pip
2条回答
乱世女痞
2楼-- · 2019-05-10 04:44

You can set the proxy in "/etc/pip.conf":

[global]
proxy = http://host:port
查看更多
神经病院院长
3楼-- · 2019-05-10 04:47

You can use the following command so that pip uses your proxy. The basic format is of this form:

 [user:passwd@]proxy.server:port

For example:

pip --proxy http://<your proxy>:<your port> (for http)
pip --proxy https://<your proxy>:<your port> (for https)
查看更多
登录 后发表回答