点安装几乎任何库的问题

我很难用pip来安装几乎所有东西。 我是新来的编程,所以我想也许这是我一直在做错的东西,并select了easy_install来获得我所需要做的大部分,这一般工作。 但是,现在我正在尝试下载nltk库,而且也没有完成任务。

我试图进入

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. 

有关这个问题的任何想法? 我真的很感激一些反馈,我可以如何让pip工作或者在这个问题上解决问题。

我发现将pypi主机指定为可信即可。 例:

 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 

你可能看到了这个bug 。 也请看这里 。

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

SSL错误的另一个原因可能是一个糟糕的系统时间 – 证书不能validation它是否离现在太远。

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

对于我来说,最新的点子(1.5.6)在不安全的nltk包中工作正常,如果你只是告诉它不要对安全性如此挑剔:

 pip install --upgrade --force-reinstall --allow-all-external --allow-unverified ntlk nltk 

您也可以使用conda安装软件包:请参阅http://conda.pydata.org

conda install nltk

使用conda的最好方法是下载Miniconda,但也可以尝试

 pip install conda conda init conda install nltk 

如果只是关于nltk,我曾经遇到类似的问题。 尝试下面的安装指南。 安装NLTK

如果您确定它不适用于任何其他模块,那么您可能在安装不同版本的Python时遇到问题。

或者试试看是否已经安装了pip。

 sudo apt-get install python-pip python-dev build-essential 

看看它是否有效。

我通过以下步骤解决了这个问题(在sles 11sp2上)

 zypper remove pip easy_install pip=1.2.1 pip install --upgrade scons 

这里是木偶中的相同步骤(应该在所有发行版上工作)

  package { 'python-pip': ensure => absent, } exec { 'python-pip': command => '/usr/bin/easy_install pip==1.2.1', require => Package['python-pip'], } package { 'scons': ensure => latest, provider => pip, require => Exec['python-pip'], } 

如果通过代理连接,请执行export https_proxy=<your_proxy> (在Unix或Git Bash上),然后重试安装。

如果您使用的是Windows cmd, set https_proxy=<your_proxy>更改为set https_proxy=<your_proxy>