Using pip behind a proxy with CNTLM

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

    I got the error:

    chris@green:~$ sudo http_proxy=http://localhost:3128 pip install django==1.8.8 
    Downloading/unpacking django==1.8.8
      Cannot fetch index base URL http://pypi.python.org/simple/
      Could not find any downloads that satisfy the requirement django==1.8.8
    No distributions at all found for django==1.8.8
    Storing complete log in /home/chris/.pip/pip.log
    

    (The proxy server's port is ssh port forwarded to localhost:3128).

    I had to set both http and https proxies to make it work:

    chris@green:~$ sudo http_proxy=http://localhost:3128 https_proxy=http://localhost:3128 pip install django==1.8.8
    Downloading/unpacking django==1.8.8
      Downloading Django-1.8.8.tar.gz (7.3Mb): 7.3Mb downloaded
      Running setup.py egg_info for package django
    
        warning: no previously-included files matching '__pycache__' found under directory '*'
        warning: no previously-included files matching '*.py[co]' found under directory '*'
    Installing collected packages: django
      Running setup.py install for django
    
        warning: no previously-included files matching '__pycache__' found under directory '*'
        warning: no previously-included files matching '*.py[co]' found under directory '*'
        changing mode of build/scripts-2.7/django-admin.py from 644 to 755
        changing mode of /usr/local/bin/django-admin.py to 755
        Installing django-admin script to /usr/local/bin
    Successfully installed django
    Cleaning up...
    

    as http://pypi.python.org/simple/ redirects to https://pypi.python.org/simple but pip's error does not tell you.

提交回复
热议问题