pip 连接失败:无法获取索引基 URL http://pypi.python.org/simple/

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21294997/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 22:31:38  来源:igfitidea点击:

pip connection failure: cannot fetch index base URL http://pypi.python.org/simple/

pythongitubuntupipgit-review

提问by Sai Wai Maung

I run sudo pip install git-review, and get the following messages:

我运行sudo pip install git-review,并收到以下消息:

Downloading/unpacking git-review
  Cannot fetch index base URL http://pypi.python.org/simple/
  Could not find any downloads that satisfy the requirement git-review
No distributions at all found for git-review
Storing complete log in /home/sai/.pip/pip.log

Does anyone has any idea about this?

有没有人对此有任何想法?

回答by Ossama

Check your proxy connection, I had a similar issue, then I changed my connection which wasn't proxied and boom, of it started downloading and setting up the library

检查您的代理连接,我遇到了类似的问题,然后我更改了未代理和繁荣的连接,它开始下载和设置库

回答by Aaron Lelevier

EDIT:

编辑:

The current version of PIPno longer has this issue. As of right now, version: 7.1.2is the current version. Here is the PIPlink:

现在的版本已经PIP没有这个问题了。截至目前, version:7.1.2是当前版本。这是PIP链接:

https://pypi.python.org/pypi/pip

https://pypi.python.org/pypi/pip

ORIGINAL FIX:

原始修复:

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

我在尝试使用时遇到了这个问题 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.logit will give you more detail.

这是一个与 PIP 和 Python 的 PYPI 信任 SSL 证书相关的问题。如果您查看 Mac OS X 中的 PIP 日志:/Users/username/.pip/pip.log它将为您提供更多详细信息。

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

在尝试不同的东西数小时后,我让 PIP 备份和运行的解决方法是在 Python 中进入我的站点包,无论它是在virtualenv 中还是在您的普通站点包中,并摆脱当前的 PIP 版本。对我来说,我有pip==1.5.4

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

我删除了 PIP 目录和 PIP egg 文件。然后我跑了

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.txtwithin my virtualenv to set up all packages that I wanted that were listed in my requirements.txtfile.

这个版本的 PIP 没有 SSL 问题,然后我能够pip install -r requirements.txt在我的 virtualenv 中运行我的正常程序来设置我想要的所有包,这些包在我的requirements.txt文件中列出。

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

这也是我发现的这个 Google Group 上的几个人通过这个问题的推荐 hack:

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

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

回答by Lurchman

I had a similar problem, but in my case I was getting the error:

我有一个类似的问题,但就我而言,我收到了错误:

Downloading/unpacking bencode
  Cannot fetch index base URL http://c.pypi.python.org/simple/
  Could not find any downloads that satisfy the requirement bencode
No distributions at all found for bencode
Storing complete log in /home/andrew/.pip/pip.log

In my case I was able to fix the error by editing ~/.pip/pip.conf and changing http://c.pypi.python.org/simple/to http://pypi.python.org/simpleand then pip worked fine again.

在我的情况下,我能够通过编辑 ~/.pip/pip.conf 并更改http://c.pypi.python.org/simple/http://pypi.python.org/simple然后 pip 再次正常工作来修复错误。

回答by Fred Schoen

I got this error message in ~/.pip/pip.log

我收到此错误消息 ~/.pip/pip.log

Could not fetch URL https://pypi.python.org/simple/: connection error: [Errno 185090050] _ssl.c:344: error:0B084002:x509 certificate routines:X509_load_cert_crl_file:system lib
  Will skip URL https://pypi.python.org/simple/ when looking for download links for regulargrid

I fixed it by updating my ~/.pip/pip.conf. It accidentally pointed to cacert.pemfile that did not exist and looked like this

我通过更新我的~/.pip/pip.conf. 它不小心指向了cacert.pem不存在的文件,看起来像这样

[global]
cert = /some/path/.pip/cacert.pem

回答by lapin

I used to use the easy_install pip==1.2.1workaround but I randomly foundthat if you're having this bug, you probably installed a 32bit version of python.

我曾经使用该easy_install pip==1.2.1解决方法,但我随机发现如果您遇到此错误,则您可能安装了 32 位版本的 python。

If you install a 64bit version of it by installing it from the source and then build you virtualenv upon it, you wont have that pip bug anymore.

如果您通过从源代码安装它来安装它的 64 位版本,然后在其上构建您的 virtualenv,您将不再有那个 pip 错误。

回答by Chelfi

I added --proxy command line option to point to the proxy and it's working (pip version is 1.5.4 and python 2.7). for some reason it was not taking the shell env variables HTTPS_PROXY, HTTP_PROXY, https_proxy, http_proxy.

我添加了 --proxy 命令行选项来指向代理并且它正在工作(pip 版本是 1.5.4 和 python 2.7)。出于某种原因,它没有采用 shell 环境变量 HTTPS_PROXY、HTTP_PROXY、https_proxy、http_proxy。

sudo pip --proxy [user:passwd@]proxy.server:port install git-review

回答by Jugal Panchal

I faced same problem but that was related proxy. it was resolved by setting proxy.

我遇到了同样的问题,但那是相关的代理。它是通过设置代理解决的。

Set http_proxy=http://myuserid:mypassword@myproxyname:myproxyport
Set https_proxy=http://myuserid:mypassword@myproxyname:myproxyport

This might help someone.

这可能会帮助某人。

回答by AnneTheAgile

I was able to fix this by upgrading my python, which had previously been attached to an outdated version of OpenSSL. Now it is using 1.0.1h-1 and my package will pip install.

我能够通过升级我的 python 来解决这个问题,我的 python 以前附加到过时的 OpenSSL 版本。现在它使用 1.0.1h-1,我的包将 pip 安装。

FYI, my log and commands, using anaconda and installing the pytest-ipynb package [1] :

仅供参考,我的日志和命令,使用 anaconda 并安装 pytest-ipynb 包 [1]:


$ conda update python
Fetching package metadata: ....
Solving package specifications: .
Package plan for installation in environment /Users/me/anaconda/envs/py27:

The following NEW packages will be INSTALLED: openssl: 1.0.1h-1

The following packages will be UPDATED: python: 2.7.5-3 --> 2.7.8-1 readline: 6.2-1 --> 6.2-2 sqlite: 3.7.13-1 --> 3.8.4.1-0 tk: 8.5.13-1 --> 8.5.15-0

Proceed ([y]/n)? y Unlinking packages ... [ COMPLETE ] |#############################################################| 100% Linking packages ... [ COMPLETE ] |#############################################################| 100%

$ pip install pytest-ipynb Downloading/unpacking pytest-ipynb Downloading pytest-ipynb-0.1.1.tar.gz Running setup.py (path:/private/var/folders/4f/b8gwyhg905x94twqw2pbklyw0000gn/T/pip_build_me/pytest-ipynb/setup.py) egg_info for package pytest-ipynb

Requirement already satisfied (use --upgrade to upgrade): pytest in /Users/me/anaconda/envs/py27/lib/python2.7/site-packages (from pytest-ipynb) Installing collected packages: pytest-ipynb Running setup.py install for pytest-ipynb

Successfully installed pytest-ipynb Cleaning up...

[1] 我关于这个问题的票; https://github.com/zonca/pytest-ipynb/issues/1https://github.com/zonca/pytest-ipynb/issues/1

回答by gerald.guisse

I too used the chosen solution (downgrading pip) to work around this issue until I ran into another seemingly unrelated issue caused by the same underlying problem. Python's version of OpenSSL was out of date. Check your OpenSSL version:

我也使用了选择的解决方案(降级 pip)来解决这个问题,直到我遇到另一个由相同的潜在问题引起的看似无关的问题。Python 的 OpenSSL 版本已过时。检查您的 OpenSSL 版本:

python -c 'import ssl; print(ssl.OPENSSL_VERSION)'

If the version is 0.9.7, that should verify that OpenSSL needs to be updated. If you know how to do that directly, great (but please let me know in a comment). If not, you can follow the advice in this answer, and reinstall python from the 64 bit/32 bit installer instead of the 32 bit only installer from python.org (I'm using python 3.4.2). I now have OpenSSL version 0.9.8, and none of these issues.

如果版本是0.9.7,则应验证 OpenSSL 是否需要更新。如果您知道如何直接执行此操作,那就太好了(但请在评论中告诉我)。如果没有,您可以遵循此答案中的建议,并从 64 位/32 位安装程序重新安装 python,而不是来自 python.org 的 32 位安装程序(我使用的是 python 3.4.2)。我现在有 OpenSSL 版本0.9.8,没有这些问题。

回答by Manas

Try doing reinstallation of pip :

尝试重新安装 pip :

curl -O https://pypi.python.org/packages/source/p/pip/pip-1.2.1.tar.gz
tar xvfz pip-1.2.1.tar.gz
cd pip-1.2.1
python setup.py install

If curl doesnot work , you will have proxy issues , Please fix that it should work fine. Check after opening google.com in your browser in linux.

如果 curl 不起作用,您将遇到代理问题,请修复它应该可以正常工作。在 linux 的浏览器中打开 google.com 后检查。

The try installing

尝试安装

pip install virtualenv