urllib2.HTTPError: HTTP Error 403: SSL is required when installing nltk==2.0.5

匿名 (未验证) 提交于 2019-12-03 02:52:02

问题:

When installing nltk==2.0.5, I get the error urllib2.HTTPError: HTTP Error 403: SSL is required. Really, I'm trying to install newspaper, but it's failing when trying to install this package.

A minimal Dockerfile to reproduce the issue:

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"] 

回答1:

  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. change DEFAULT_URL from http to https in nltk-2.0.5/distribute_setup.py
  4. pip install that directory, or if you trust I did the above then do: pip install https://s3-us-west-2.amazonaws.com/jdimatteo-personal-public-readaccess/nltk-2.0.5-https-distribute.tar.gz

Edit

If the wget link is broken, download ntlk 2.0.5 from pypi



回答2:

PyPI has disabled non HTTPS access to APIs

You can use:

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

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



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!