urllib2.HTTPError:HTTP错误403:安装nltk == 2.0.5时需要SSL

时间:2017-10-27 14:32:36

标签: pip nltk

安装nltk == 2.0.5时,收到错误urllib2.HTTPError: HTTP Error 403: SSL is required。真的,我正在尝试安装newspaper,但在尝试安装此软件包时失败了。

重现问题的最小Dockerfile:

FROM ubuntu:16.04

RUN apt-get update
RUN apt-get install -y python-pip

# problem occurs with or without the following line
RUN pip install --upgrade pip

CMD ["pip", "install", "nltk==2.0.5"]

4 个答案:

答案 0 :(得分:14)

  1. wget https://pypi.python.org/packages/source/d/nltk/nltk-2.0.5.tar.gz
  2. tar -xzf nltk-2.0.5.tar.gz
  3. DEFAULT_URL
  4. 中将nltk-2.0.5/distribute_setup.py从http更改为https
  5. pip安装该目录,或者如果你相信我做了以上那么做: pip install https://s3-us-west-2.amazonaws.com/jdimatteo-personal-public-readaccess/nltk-2.0.5-https-distribute.tar.gz
  6. 修改

    如果wget链接已损坏,请下载ntlk 2.0.5 from pypi

答案 1 :(得分:0)

这是@JDiMatteo对我有用的答案的衍生版本。

  1. wget https://pypi.python.org/packages/50/9e/39418026bf8013bbc2852c7aec3fb21e4339f6cd694934496d67a19b53b8/nltk-2.0.5.tar.gz#md5=c3f77cc1bf6c6bc85db6629b7d23c3b9
  2. tar -xzf nltk-2.0.5.tar.gz
  3. DEFAULT_URL中的httphttps更改为nltk-2.0.5/distribute_setup.py
  4. pip install ./nltk-2.0.5

答案 2 :(得分:0)

如果有人仍然面临该问题,这对我很有用。

pip install git + https://github.com/codelucas/newspaper.git@python-2-head

答案 3 :(得分:-2)

PyPI已禁用对API的非HTTPS访问

您可以使用:

pip install xxxx -i https://pypi.python.org/simple/

自:https://stackoverflow.com/a/46979531/1304650