安装几乎所有库的pip问题 [英] pip issue installing almost any library

查看:120
本文介绍了安装几乎所有库的pip问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难用pip来安装几乎所有东西.我是编码的新手,所以我认为这可能是我做错了的事情,因此选择easy_install来完成我需要完成的大部分工作,而这种工作通常是有效的.但是,现在我正在尝试下载nltk库,但都没有完成任务.

I have a difficult time using pip to install almost anything. I'm new to coding, so I thought maybe this is something I've been doing wrong and have opted out to easy_install to get most of what I needed done, which has generally worked. However, now I'm trying to download the nltk library, and neither is getting the job done.

我尝试输入

sudo pip install nltk

但收到以下答复:

/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.

对这个问题有何想法?在此期间,我非常感谢您提供一些反馈意见,以帮助我解决问题或解决问题.

Any thoughts on this issue? I'd really appreciate some feedback on how I can either get pip working or something to get around the issue in the meantime.

推荐答案

我发现将pypi主机指定为受信任就足够了.示例:

I found it sufficient to specify the pypi host as trusted. Example:

pip install --trusted-host pypi.python.org pytest-xdist
pip install --trusted-host pypi.python.org --upgrade pip

这解决了以下错误:

  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

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.html https: //bugs.python.org/issue17128 .

Update April 2018: To anyone getting the TLSV1_ALERT_PROTOCOL_VERSION error: it has nothing to do with trusted-host/verification issue of the OP or this answer. Rather the TLSV1 error is because your interpreter does not support TLS v1.2, you must upgrade your interpreter. See for example https://news.ycombinator.com/item?id=13539034, http://pyfound.blogspot.ca/2017/01/time-to-upgrade-your-python-tls-v12.html and https://bugs.python.org/issue17128.

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

Update Feb 2019: For some it may be sufficient to upgrade pip. If the above error prevents you from doing this, use get-pip.py. E.g. on Linux,

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

更多详细信息,请参见 https://pip.pypa.io/en/stable/installing/.

More details at https://pip.pypa.io/en/stable/installing/.

这篇关于安装几乎所有库的pip问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆