安装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"]
答案 0 :(得分:14)
wget https://pypi.python.org/packages/source/d/nltk/nltk-2.0.5.tar.gz
tar -xzf nltk-2.0.5.tar.gz
DEFAULT_URL
nltk-2.0.5/distribute_setup.py
从http更改为https
pip install https://s3-us-west-2.amazonaws.com/jdimatteo-personal-public-readaccess/nltk-2.0.5-https-distribute.tar.gz
修改强>
如果wget链接已损坏,请下载ntlk 2.0.5 from pypi
答案 1 :(得分:0)
这是@JDiMatteo对我有用的答案的衍生版本。
wget https://pypi.python.org/packages/50/9e/39418026bf8013bbc2852c7aec3fb21e4339f6cd694934496d67a19b53b8/nltk-2.0.5.tar.gz#md5=c3f77cc1bf6c6bc85db6629b7d23c3b9
tar -xzf nltk-2.0.5.tar.gz
DEFAULT_URL
中的http
从https
更改为nltk-2.0.5/distribute_setup.py
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/