2016-08-14 59 views
1

我正嘗試使用購物籃下載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下載命令時,我工作的罰款。

我的命令和應答是:`

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 

`

什麼是籃子的問題?以及如何解決它?

回答

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」有關

+0

在我的Windows python 3環境中工作,未在我的Ubuntu Python 2環境中測試。我認爲它會在這個補丁之後起作用。無論如何,決定報告一個補丁庫的補丁。 –