Using pip behind a proxy with CNTLM

前端 未结 30 2228
囚心锁ツ
囚心锁ツ 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:25

    To setup CNTLM for windows, follow this article. For Ubuntu, read my blog post.

    Edit:

    Basically, to use CNTLM in any platform, you need to setup your username and hashed password, before using http://127.0.0.1:3128 as a proxy to your parent proxy.

    1. Edit the config and add important information like domain, username, password and parent proxy.

    2. Generate hashed password.

      Windows cntlm –c cntlm.ini –H

      Ubuntu/Linux cntlm -v -H -c /etc/cntlm.conf

    3. Remove plain text password from the config and replace them with the generated passwords.

    To check if working:

    Windows cntlm –M http://www.google.com

    Ubuntu/Linux sudo cntlm -M http://www.google.com/

    For more detailed instructions, see links above.

    Update:

    Just for completeness sake, I was able to configure and use CNTLM in Windows recently. I encountered a problem during the syncing process of Kindle for PC because of our proxy and installing and configuring CNTLM for Windows fixed that issue for me. Refer to my article for more details.

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

    How about just doing it locally? Most likely you are able to download from https source through your browser

    1. Download your module file (mysql-connector-python-2.0.3.zip /gz... etc).
    2. Extract it and go the extracted dir where setup.py is located and call:

      C:\mysql-connector-python-2.0.3>python.exe setup.py install
      
    0 讨论(0)
  • 2020-11-22 11:28

    With Ubuntu I could not get the proxy option to work as advertised – so following command did not work:

    sudo pip --proxy http://web-proxy.mydomain.com install somepackage
    

    But exporting the https_proxy environment variable (note its https_proxy not http_proxy) did the trick:

    export https_proxy=http://web-proxy.mydomain.com
    

    then

    sudo -E pip install somepackage
    
    0 讨论(0)
  • 2020-11-22 11:28

    It was not working for me. I had to use https at work:

    pip install --proxy=https://user@mydomain:port somepackage
    

    In order to update, add -U.

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

    Warning, there is something very bad with the "pip search" command. The search command do not use the proxy setting regardless of the way it's being passed.

    I was trying to figure out the problem only trying the "search" command, and found this post with detailed explanation about that bug: https://github.com/pypa/pip/issues/1104

    I can confirm the bug remains with pip 1.5.6 on Debian 8 with python 2.7.9. The "pip install" command works like a charm.

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

    Set up invironment variable in Advanced System Settings. In Command prompt it should behave like this :

    C:\Windows\system32>echo %http_proxy%

    http://username:passowrd@proxy:port

    C:\Windows\system32>echo %https_proxy%

    http://username:password@proxy:port

    Later , Simply pip install whatEver should work.

    0 讨论(0)
提交回复
热议问题