使用pip安装google应用程序引擎时出现错误
Collecting google_appengine
Downloading google-appengine-1.5.1.tar.gz (897kB)
100% |████████████████████████████████| 901kB 1.9MB/s
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 "/private/var/folders/88/5jq5gz011sl63h_37k_qftv40000gn/T/pip-build-vxx8Ov/google-appengine/setup.py", line 3, in <module>
ez_setup.use_setuptools()
File "/Users/user/path to project/project/venv/lib/python2.7/site-packages/ez_setup.py", line 145, in use_setuptools
return _do_download(version, download_base, to_dir, download_delay)
File "/Users/user/path to project/project/venv/lib/python2.7/site-packages/ez_setup.py", line 124, in _do_download
to_dir, download_delay)
File "/Users/user/path to project/project/venv/lib/python2.7/site-packages/ez_setup.py", line 193, in download_setuptools
src = urlopen(url)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 154, in urlopen
return opener.open(url, data, timeout)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 437, in open
response = meth(req, response)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 550, in http_response
'http', request, response, code, msg, hdrs)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 475, in error
return self._call_chain(*args)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 409, in _call_chain
result = func(*args)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 558, 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 /private/var/folders/88/5jq5gz011sl63h_37k_qftv40000gn/T/pip-build-vxx8Ov/google-appengine/`
发布于 2017-10-28 00:21:40
这是因为PyPI已经禁用了对API的非HTTPS访问
https://mail.python.org/pipermail/distutils-sig/2017-October/031712.html
作为变通办法,您可以使用
$ pip install xxxx -i https://pypi.python.org/simple/
发布于 2020-05-21 05:16:45
不幸的是,之前的答案对我都不起作用。
我想这是非常愚蠢的pip / distutils选择在http repos上破解包。
我认为更好的选择应该是:
仍然在2020年,许多Python 2包都在http repos上;由于他们的决定,这些包的安装被破坏了。
对我来说,有效的解决方案是一个非常简单的python核心模块的补丁:
--- /usr/local/lib/python2.7/urllib2.py.original
+++ /usr/local/lib/python2.7/urllib2.py
@@ -427,6 +427,9 @@
req = meth(req)
response = self._open(req, data)
+ if protocol == "http" and response.code == 403 :
+ if isinstance(fullurl, basestring) and fullurl.startswith("http://pypi.python.org/packages/source/d/distribute/") :
+ return self.open(fullurl.replace("http://", "https://"), data = data, timeout = timeout)
# post-process response
meth_name = protocol+"_response"
工作中:如果失败的url在http上,请在https上重试。
我知道它有点难看,但它非常清晰,而且您可以在应用此补丁之前快速恢复到原始模块(复制/usr/local/lib/python2.7/urllib2.py )。
发布于 2017-11-03 13:22:28
收到错误。问题出在存储库中pip试图安装软件包的位置。
https://stackoverflow.com/questions/46967488
复制相似问题