ほぼすべてのライブラリをインストールする際のpipの問題 質問する

ほぼすべてのライブラリをインストールする際のpipの問題 質問する

pip を使用してほとんどすべてのものをインストールするのに苦労しています。私はコーディングの初心者なので、これは私が何か間違ったことをしているのではないかと考え、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 を動作させる方法や、その間に問題を回避する方法について、フィードバックをいただければ幸いです。

ベストアンサー1

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

2018年4月更新: TLSV1_ALERT_PROTOCOL_VERSIONエラーを受け取った方へ: これはOPやこの回答の信頼できるホスト/検証の問題とは関係ありません。 TLSV1エラーはインタープリタがTLS v1.2をサポートしていないために発生するので、インタープリタをアップグレードする必要があります。 たとえば、https://news.ycombinator.com/item?id=13539034python のアップグレードそして翻訳: 翻訳者: 渡辺 俊之

2019年2月更新: 一部のケースでは、pip をアップグレードするだけで十分かもしれません。上記のエラーによりアップグレードできない場合は、get-pip.py を使用してください。たとえば、Linux では、

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

詳細はhttps://pip.pypa.io/en/stable/インストール/

おすすめ記事