How to set an HTTP proxy in Python 2.7?

前端 未结 6 436
無奈伤痛
無奈伤痛 2020-11-29 18:38

I am trying to run a script that installs pip: get-pip.py and am getting a connection timeout due to my network being behind an HTTP proxy. Is there some way I could configu

6条回答
  •  眼角桃花
    2020-11-29 18:57

    You can install pip (or any other package) with easy_install almost as described in the first answer. However you will need a HTTPS proxy, too. The full sequence of commands is:

    set http_proxy=http://proxy.myproxy.com
    set https_proxy=http://proxy.myproxy.com
    easy_install pip
    

    You might also want to add a port to the proxy, such as http{s}_proxy=http://proxy.myproxy.com:8080

提交回复
热议问题