Python pip error: “Cannot fetch index base URL https://pypi.python.org/simple/”

后端 未结 6 700
死守一世寂寞
死守一世寂寞 2021-02-05 08:38

I\'m trying to install several packages using pip. When I do this using sudo, this error occurs: \"Cannot fetch index base URL https://pypi.python.org/simple/\". When I execute

6条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-05 08:51

    I got this issue when trying to use pip==1.5.4

    This is an issue related to PIP and Python's PYPI trusting SSL certificates. If you look in the PIP log in Mac OS X at: /Users/username/.pip/pip.log it will give you more detail.

    My workaround to get PIP back up and running after hours of trying different stuff was to go into my site-packages in Python whether it is in a virtualenv or in your normal site-packages, and get rid of the current PIP version. For me I had pip==1.5.4

    I deleted the PIP directory and the PIP egg file. Then I ran

    easy_install pip==1.2.1  
    

    This version of PIP doesn't have the SSL issue, and then I was able to go and run my normal pip install -r requirements.txt within my virtualenv to set up all packages that I wanted that were listed in my requirements.txt file.

    This is also the recommended hack to get passed the issue by several people on this Google Group that I found:

    https://groups.google.com/forum/#!topic/beagleboard/aSlPCNYcVjw

    [edit]

    If you have a different version of PIP installed globally, every time you create a new virtualenv it will install that version of PIP, so you will have to do this each time for each new PIP unless you change the globally installed version. I ran into this issue when starting a new project, and had to do the fix again and revert back to pip==1.2.1

提交回复
热议问题