pip问题几乎安装任何库

con*_*own 93 python pip nltk easy-install

我很难用pip安装几乎任何东西.我是编码的新手,所以我想也许这是我一直做错的事情,并选择了easy_install以获得我需要做的大部分工作,这通常都有效.但是,现在我正在尝试下载nltk库,并且都没有完成工作.

我试过进去

sudo pip install nltk
Run Code Online (Sandbox Code Playgroud)

但得到了以下回应:

/Library/Frameworks/Python.framework/Versions/2.7/bin/pip run on Sat May  4 00:15:38 2013
Downloading/unpacking nltk

  Getting page https://pypi.python.org/simple/nltk/
  Could not fetch URL [need more reputation to post link]: There was a problem confirming the ssl certificate: <urlopen error [Errno 1] _ssl.c:504: error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm>

  Will skip URL [need more reputation to post link]/simple/nltk/ when looking for download links for nltk

  Getting page [need more reputation to post link]/simple/
  Could not fetch URL https://pypi.python. org/simple/: There was a problem confirming the ssl certificate: <urlopen error [Errno 1] _ssl.c:504: error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm>

  Will skip URL [need more reputation to post link] when looking for download links for nltk

  Cannot fetch index base URL [need more reputation to post link]

  URLs to search for versions for nltk:
  * [need more reputation to post link]
  Getting page [need more reputation to post link]
  Could not fetch URL [need more reputation to post link]: There was a problem confirming the ssl certificate: <urlopen error [Errno 1] _ssl.c:504: error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm>

  Will skip URL [need more reputation to post link] when looking for download links for nltk

  Could not find any downloads that satisfy the requirement nltk

No distributions at all found for nltk

Exception information:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/basecommand.py", line 139, in main
    status = self.run(options, args)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/commands/install.py", line 266, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/req.py", line 1026, in prepare_files
    url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg/pip/index.py", line 171, in find_requirement
    raise DistributionNotFound('No distributions at all found for %s' % req)
DistributionNotFound: No distributions at all found for nltk

--easy_install installed fragments of the library and the code ran into trouble very quickly upon trying to run it.
Run Code Online (Sandbox Code Playgroud)

有关这个问题的任何想法?我真的很感激一些反馈,我可以在此期间获得pip工作或解决问题.

Oli*_*ver 131

我发现将pypi主机指定为受信任是足够的.例:

pip install --trusted-host pypi.python.org pytest-xdist
pip install --trusted-host pypi.python.org --upgrade pip
Run Code Online (Sandbox Code Playgroud)

这解决了以下错误:

  Could not fetch URL https://pypi.python.org/simple/pytest-cov/: There was a problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600) - skipping
  Could not find a version that satisfies the requirement pytest-cov (from versions: )
No matching distribution found for pytest-cov
Run Code Online (Sandbox Code Playgroud)

2018年4月更新:对于收到TLSV1_ALERT_PROTOCOL_VERSION错误的任何人:它与OP的可信主机/验证问题或此答案无关.而是TLSV1错误是因为您的解释器不支持TLS v1.2,您必须升级您的解释器.例如见https://news.ycombinator.com/item?id=13539034,http://pyfound.blogspot.ca/2017/01/time-to-upgrade-your-python-tls-v12.htmlHTTPS ://bugs.python.org/issue17128.

更新2019年2月:对于某些人来说,升级点数可能就足够了.如果上述错误阻止您执行此操作,请使用get-pip.py.例如在Linux上,

curl https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
Run Code Online (Sandbox Code Playgroud)

有关详细信息,访问https://pip.pypa.io/en/stable/installing/.

  • 我仍然收到错误 - "无法获取URL https://pypi.python.org/simple/pytest-xdist/:确认ssl证书时出现问题:[SSL:TLSV1_ALERT_PROTOCOL_VERSION] tlsv1警报协议版本(_ssl.c :590) - 跳过` (16认同)
  • @peterpod看到这个答案:/sf/answers/3483831081/ (8认同)
  • 多年以后,这在Windows系统上对我有用 (4认同)
  • 我已经更新了我的答案,谈论TLSV1,因为它是一个完全独立的问题. (3认同)
  • /sf/ask/3483813931/#49769015 (2认同)

小智 39

我使用了pip版本9.0.1并遇到了同样的问题,上面的所有答案都没有解决问题,而且由于其他原因我无法使用brew安装python/pip.

升级点来9.0.3解决问题.因为我无法使用pip升级pip,所以我下载了源代码并手动安装了它.

  1. 从 - https://pypi.org/simple/pip/下载正确版本的点子
  2. sudo python3 pip-9.0.3.tar.gz - 安装点子

或者你可以安装更新的点子:

curl https://bootstrap.pypa.io/get-pip.py | python
Run Code Online (Sandbox Code Playgroud)


小智 32

Pypi删除了对小于1.2的TLS版本的支持

你需要重新安装Pip,做

curl https://bootstrap.pypa.io/get-pip.py | python
Run Code Online (Sandbox Code Playgroud)

或者对于全局Python:

curl https://bootstrap.pypa.io/get-pip.py | sudo python
Run Code Online (Sandbox Code Playgroud)


Aac*_*hen 28

我使用了pip3版本,9.0.1并且最近无法通过命令安装任何软件包pip3 install.

Mac OS版本:EI Captain 10.11.5.

python版本: 3.5

我试过这个命令:

curl https://bootstrap.pypa.io/get-pip.py | python

它对我不起作用.

所以我卸载了旧的pip并10.0.0通过输入以下命令安装了最新的版本:

python3 -m pip uninstall pip setuptools
curl https://bootstrap.pypa.io/get-pip.py | python3
Run Code Online (Sandbox Code Playgroud)

现在我的问题解决了.如果你使用python2,你可以用python替换python3.我希望它也适合你.


Dou*_*gal 27

你可能已经看到了这个bug ; 另见这里.

最简单的解决方法是将pip降级为不使用SSL的pip : easy_install pip==1.2.1. 这会使您失去使用SSL的安全优势.真正的解决方案是使用链接到更新SSL库的Python分发.

  • @ user2348946你做了什么,这对以后的人有用? (7认同)

pid*_*dge 18

SSL错误的另一个原因可能是系统时间不好 - 如果距离现在太远,证书将无法验证.


小智 10

对我有用的唯一解决方案是:

sudo curl https://bootstrap.pypa.io/get-pip.py | sudo python


dat*_*ung 9

我尝试了一些流行的答案,但仍然无法使用pip install.

我的具体错误是'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain使用 Miniconda for Windows(安装程序 Miniconda3-py37_4.8.3-Windows-x86.exe)。

当我这样做时,它终于起作用了: pip install -r requirements.txt --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org

具体来说,我添加了这个以使其工作: --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org


小智 6

要安装任何其他软件包,我必须使用最新版本的pip,因为9.0.1有这个SSL问题.要通过pip本身升级pip,我必须先解决这个SSL问题.为了跳出这个无限循环,我发现这只适用于我的方式.

  1. 在此页面中找到最新版本的pip:https: //pypi.org/simple/pip/
  2. 下载.whl最新版本的文件.
  3. 使用pip安装最新的pip.(在这里使用您自己的最新版本)

sudo pip install pip-10.0.1-py2.py3-none-any.whl

现在pip是最新版本,可以安装任何东西.


Rub*_*ben 5

我通过添加--trusted-host pypi.python.org选项解决了类似的问题


Rol*_*sta 5

解决方案 -通过标记以下受信任的主机来安装任何软件包

  • pypi.python.org
  • pypi.org
  • files.pythonhosted.org

临时解决方案

pip install --trusted-host pypi.python.org --trusted-host pypi.org --trusted-host files.pythonhosted.org {package name}
Run Code Online (Sandbox Code Playgroud)

永久解决方案 -将您的PIP(9.0.1版问题)更新为最新版本。

pip install --trusted-host pypi.python.org --trusted-host pypi.org --trusted-host files.pythonhosted.org pytest-xdist

python -m pip install --trusted-host pypi.python.org --trusted-host pypi.org --trusted-host files.pythonhosted.org --upgrade pip
Run Code Online (Sandbox Code Playgroud)


abh*_*bhi 5

正如blackjar在上面发布的那样,以下几行对我有用

pip --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org install xxx
Run Code Online (Sandbox Code Playgroud)

你需要给所有三个--trusted-host options。在查看答案后,我只尝试使用第一个,但它对我不起作用。