python pip设置代理

python 安装 urllib2 库时,

pip install  urllib2 报错如下,


  Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connec
tion broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connectio
n failed: 407 Proxy Authentication Required ( Forefront TMG requires authorizati
on to fulfill the request. Access to the Web Proxy filter is denied.  )',))': /s
imple/webscraping/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None)) after connec
tion broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connectio
n failed: 407 Proxy Authentication Required ( Forefront TMG requires authorizati
on to fulfill the request. Access to the Web Proxy filter is denied.  )',))': /s
imple/webscraping/
  Could not find a version that satisfies the requirement webscraping (from vers
ions: )
No matching distribution found for webscraping



需设置代理

set HTTP_PROXY=domain\username:password@proxy:port
set HTTPS_PROXY=domain\username:password@proxy:port


执行如下命令即可,
set HTTP_PROXY=icccuat\user_name:password@proxy_ip:port
set HTTPS_PROXY=icccuat\user_name:password@proxy_ip:port
pip install  urllib2



你可能感兴趣的:(Python)