urllib2.HTTPError:HTTP错误403:即使使用了pip升级和--index选项,也需要SSL

问题描述 投票:1回答:2

我已经阅读过Cannot install distribute: pypi.python.org rejecting httpGetting error 403 while installing package with pip但是工作并不奏效

在尝试的时候

pip install --upgrade pyls --index-url=https://pypi.python.org/simple我得到了:

Collecting pyls
  Using cached pyls-0.1.3.zip
    Complete output from command python setup.py egg_info:
    Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.14.tar.gz
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-PHBndM/pyls/setup.py", line 31, in <module>
        main()
      File "/tmp/pip-build-PHBndM/pyls/setup.py", line 11, in main
        distribute_setup.use_setuptools()
      File "setup_utils/distribute_setup.py", line 145, in use_setuptools
        return _do_download(version, download_base, to_dir, download_delay)
      File "setup_utils/distribute_setup.py", line 124, in _do_download
        to_dir, download_delay)
      File "setup_utils/distribute_setup.py", line 193, in download_setuptools
        src = urlopen(url)
      File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen
        return opener.open(url, data, timeout)
      File "/usr/lib/python2.7/urllib2.py", line 435, in open
        response = meth(req, response)
      File "/usr/lib/python2.7/urllib2.py", line 548, in http_response
        'http', request, response, code, msg, hdrs)
      File "/usr/lib/python2.7/urllib2.py", line 473, in error
        return self._call_chain(*args)
      File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain
        result = func(*args)
      File "/usr/lib/python2.7/urllib2.py", line 556, in http_error_default
        raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
    urllib2.HTTPError: HTTP Error 403: SSL is required
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-hdpX4y/pyls/

我的python版本是2.7,而我的pip版本是

pip 9.0.2 from /usr/local/lib/python2.7/dist-packages (python 2.7)

重现:

旋转这个docker实例https://hub.docker.com/r/allansimon/allan-docker-dev-python并在其中启动命令(使用用户vagrant

python pip
2个回答
0
投票

我也试图升级pyls而不是python-language-server,我也遇到了同样的错误。这样做对我有用:

pip install --upgrade python-language-server

资料来源:https://github.com/palantir/python-language-server/issues/395


-1
投票

我试过它对我有用:

pip install --upgrade pyls -i https://pypi.python.org/simple
© www.soinside.com 2019 - 2024. All rights reserved.