我正在尝试使用购物篮下载Pypi包。但该命令显示" ProtocolError for pypi.python.org/pypi: 403 Must access using HTTPS instead of HTTP
"消息。
我的命令是:sudo basket download unittest2
回复是:
`Traceback (most recent call last):
File "/usr/local/bin/basket", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/basket/main.py", line 338, in main
return basket.cmd_download(argv)
File "/usr/local/lib/python2.7/dist-packages/basket/main.py", line 220, in cmd_download
info = self._find_package_name(package)
File "/usr/local/lib/python2.7/dist-packages/basket/main.py", line 88, in _find_package_name
for info in self.client.search({'name': query}):
File "/usr/lib/python2.7/xmlrpclib.py", line 1243, in __call__
return self.__send(self.__name, args)
File "/usr/lib/python2.7/xmlrpclib.py", line 1602, in __request
verbose=self.__verbose
File "/usr/lib/python2.7/xmlrpclib.py", line 1283, in request
return self.single_request(host, handler, request_body, verbose)
File "/usr/lib/python2.7/xmlrpclib.py", line 1331, in single_request
response.msg,
xmlrpclib.ProtocolError: <ProtocolError for pypi.python.org/pypi: 403 Must access using HTTPS instead of HTTP>`
但是pip download命令对我来说很好。
我的命令和回应是:`
pip download unittest2
Collecting unittest2
Downloading unittest2-1.1.0-py2.py3-none-any.whl (96kB)
100% |████████████████████████████████| 102kB 107kB/s
Saved ./unittest2-1.1.0-py2.py3-none-any.whl
Collecting argparse (from unittest2)
Downloading argparse-1.4.0-py2.py3-none-any.whl
Saved ./argparse-1.4.0-py2.py3-none-any.whl
Collecting traceback2 (from unittest2)
Downloading traceback2-1.4.0-py2.py3-none-any.whl
Saved ./traceback2-1.4.0-py2.py3-none-any.whl
Collecting six>=1.4 (from unittest2)
Downloading six-1.10.0-py2.py3-none-any.whl
Saved ./six-1.10.0-py2.py3-none-any.whl
Collecting linecache2 (from traceback2->unittest2)
Downloading linecache2-1.0.0-py2.py3-none-any.whl
Saved ./linecache2-1.0.0-py2.py3-none-any.whl
Successfully downloaded unittest2 argparse traceback2 six linecache2
`
篮子有什么问题?以及如何解决它?
答案 0 :(得分:3)
您必须进入/path-to-python-site-packages/basket/main.py,并编辑以下行:
PYPI_ENDPOINT = 'http://pypi.python.org/pypi'
并将其更改为“https”:
PYPI_ENDPOINT = 'https://pypi.python.org/pypi'
然后你的下载应该有效。问题与提供给“xmlrpclib.ServerProxy”
的“http”有关