为什么 pip 搜索某些术语会失败?

为什么 pip 搜索某些术语会失败?

对于诸如 sqlite、virtualenv 等术语,它很快返回,但是为什么 django 查询会失败?

此故障已发生 3 次以上

pip search django
Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/pip/basecommand.py", line 107, in main
    status = self.run(options, args)
  File "/usr/local/lib/python2.6/dist-packages/pip/commands/search.py", line 34, in run
    pypi_hits = self.search(query, index_url)
  File "/usr/local/lib/python2.6/dist-packages/pip/commands/search.py", line 48, in search
    hits = pypi.search({'name': query, 'summary': query}, 'or')
  File "/usr/lib/python2.6/xmlrpclib.py", line 1199, in __call__
    return self.__send(self.__name, args)
  File "/usr/lib/python2.6/xmlrpclib.py", line 1489, in __request
    verbose=self.__verbose
  File "/usr/lib/python2.6/xmlrpclib.py", line 1253, in request
    return self._parse_response(h.getfile(), sock)
  File "/usr/lib/python2.6/xmlrpclib.py", line 1382, in _parse_response
    response = file.read(1024)
  File "/usr/lib/python2.6/socket.py", line 377, in read
    data = self._sock.recv(left)
timeout: timed out

答案1

许多 Python 包的名称中都有“django”,因此 pypi 无法及时返回所有数据。您可以使用--timeout选项增加超时时间(默认值为 15 秒)。

相关内容