使用pip时获取ConnectionError

时间:2016-05-23 22:40:57

标签: python pip

我在debian chroot中使用pip。我将/etc/resolv.conf从主机复制到了chroot。我可以ping www.google.com和其他网站。

当我在chroot中运行pip搜索pyopenssl时,我得到以下错误。

File "/usr/local/lib/python2.7/site-packages/pip/utils/outdated.py", line 122, in pip_version_check
    headers={"Accept": "application/json"},
  File "/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 477, in get
    return self.request('GET', url, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/pip/download.py", line 373, in request
    return super(PipSession, self).request(method, url, *args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 465, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/sessions.py", line 573, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/pip/_vendor/cachecontrol/adapter.py", line 46, in send
    resp = super(CacheControlAdapter, self).send(request, **kw)
  File "/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/adapters.py", line 424, in send
    raise ConnectionError(e, request=request)
ConnectionError: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /pypi/pip/json (Caused by ProtocolError('Connection aborted.', error(0, 'Error')))
Starting new HTTPS connection (1): pypi.python.org
Incremented Retry for (url='/pypi'): Retry(total=4, connect=None, read=None, redirect=None)
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ProtocolError('Connection aborted.', error(0, 'Error'))': /pypi
Starting new HTTPS connection (2): pypi.python.org

1 个答案:

答案 0 :(得分:0)

好的问题是/ proc和/ dev目录没有从主机挂载到chroot。安装后,pip工作。非常令人惊讶。