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

时间:2018-03-17 10:08:17

标签: python pip

我已经阅读了Cannot install distribute: pypi.python.org rejecting httpGetting error 403 while installing package with pip,但解决方法并不适用

尝试时

<div class="task-manager_block" ng-controller="ToDoCtrl"> <div class="form_block clearfix"> <form name="addToDo"> <input class="add-input" placeholder="I need to..." type="text" name="inputToDo" ng-model="formTodoText" ng-model-instant ng-minlenght ng-minlength="5" ng-maxlength="40" ng-required="true"/> <button class="add-btn" ng-click="addTodo()" ng-disabled="! addToDo.inputToDo.$valid "><h2>Add</h2></button> </form> </div> <div class="tasks_block" ng-controller="DatepickerPopupCtrl"> <div class="task_block col-md-3" ng-repeat="todo in todos"> <div class="text_block"> <p class="input-group"> <input type="text" class="form-control" uib-datepicker-popup="{{format}}" ng-model="dt" is-open="popup1.opened" datepicker-options="dateOptions" ng-required="true" close-text="Close" alt-input-formats="altInputFormats" /> <span class="input-group-btn"> <button type="button" class="btn btn-default" ng-click="open1()"><i class="glyphicon glyphicon-calendar"></i></button> </span> </p> <p>{{todo.text}}</p> </div> </div> </div> </div> 我得到了:

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

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

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/

重现:

旋转此泊坞窗实例pip 9.0.2 from /usr/local/lib/python2.7/dist-packages (python 2.7)并在其中启动命令(使用用户https://hub.docker.com/r/allansimon/allan-docker-dev-python

3 个答案:

答案 0 :(得分:1)

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

pip install --upgrade python-language-server

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

答案 1 :(得分:0)

我试过它对我有用:

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

答案 2 :(得分:0)

当jython执行ez_setup.py时,我遇到了类似的问题。事实证明,我只需要在脚本的其中一个网址中用https替换http。