简体   繁体   中英

Configuring PIP to work from behind a proxy

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.!

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)

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

[global]
proxy = http://host:port

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM