How to set an HTTP proxy in Python 2.7?

前端 未结 6 445
無奈伤痛
無奈伤痛 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 19:05

    For installing pip with get-pip.py behind a proxy I went with the steps below. My server was even behind a jump server.

    From the jump server:

    ssh -R 18080:proxy-server:8080 my-python-server
    

    On the "python-server"

    export https_proxy=https://localhost:18080 ; export http_proxy=http://localhost:18080 ; export ftp_proxy=$http_proxy
    python get-pip.py
    

    Success.

提交回复
热议问题