Using pip behind a proxy with CNTLM

前端 未结 30 2230
囚心锁ツ
囚心锁ツ 2020-11-22 11:00

I am trying to use pip behind a proxy at work.

One of the answers from this post suggested using CNTLM. I installed and configured it per this other post, but runnin

相关标签:
30条回答
  • 2020-11-22 11:45

    Phone as mobile hotspot/USB tethering

    If I have much trouble finding a way through the corporate proxy, I connect to the web through my phone (wireless hotspot if I have wifi, USB tether if not) and do a quick pip install.

    Might not work for all setups, but should get most people by in a pinch.

    0 讨论(0)
  • 2020-11-22 11:45

    Using pip behind a work proxy with authentification, note that quotation is required for some OSes when specifing the proxy url with user and password:

    pip install <module> --proxy 'http://<proxy_user>:<proxy_password>@<proxy_ip>:<proxy_port>'
    

    Documentation: https://pip.pypa.io/en/stable/user_guide/#using-a-proxy-server

    Example:

    pip3 install -r requirements.txt --proxy 'http://user:password@192.168.0.1:1234'
    

    Example:

    pip install flask --proxy 'http://user:password@192.168.0.1:1234'
    

    Proxy can also be configured manually in pip.ini. Example:

    [global]
    proxy = http://user:password@192.168.0.1:1234 
    

    Documentation: https://pip.pypa.io/en/stable/user_guide/#config-file

    0 讨论(0)
  • 2020-11-22 11:49
    $ pip --proxy http://proxy-host:proxy-port install packagename
    

    This is what worked for me on

    0 讨论(0)
  • 2020-11-22 11:50

    Open the Windows command prompt.

    Set proxy environment variables.

    set http_proxy=http://user:password@proxy_ip:port
    set https_proxy=https://user:password@proxy_ip:port
    

    Install Python packages using proxy in the same Windows command prompt.

    pip install --proxy="user:password@proxy_ip:port" package_name
    
    0 讨论(0)
  • 2020-11-22 11:51

    I could achieve this by running:

    pip install --proxy=http://user:pass@your.proxy.com:3128 package==version
    

    I'm using Python 3.7.3 inside a corporative proxy.

    0 讨论(0)
  • 2020-11-22 11:51

    if you want to upgrade pip by proxy, can use (for example in Windows):

    python -m pip --proxy http://proxy_user:proxy_password@proxy_hostname:proxy_port insta
    ll --upgrade pip
    
    0 讨论(0)
提交回复
热议问题