小编典典

点子搜索Django产生超时错误

python

巧合的是,我运行pip search django命令,但出现超时错误。甚至指定了很高的超时值

在日志下方:

D:\PERFILES\rmaceissoft\virtualenvs\fancy_budget\Scripts>pip search django --timeout=300
Exception:
Traceback (most recent call last):
  File "D:\PERFILES\Marquez\rmaceissoft\Workspace\virtualenvs\fancy_budget\lib\s
ite-packages\pip-1.1-py2.7.egg\pip\basecommand.py", line 104, in main
    status = self.run(options, args)
  File "D:\PERFILES\Marquez\rmaceissoft\Workspace\virtualenvs\fancy_budget\lib\s
ite-packages\pip-1.1-py2.7.egg\pip\commands\search.py", line 34, in run
    pypi_hits = self.search(query, index_url)
  File "D:\PERFILES\Marquez\rmaceissoft\Workspace\virtualenvs\fancy_budget\lib\s
ite-packages\pip-1.1-py2.7.egg\pip\commands\search.py", line 48, in search
    hits = pypi.search({'name': query, 'summary': query}, 'or')
  File "C:\Python27\Lib\xmlrpclib.py", line 1224, in __call__
    return self.__send(self.__name, args)
  File "C:\Python27\Lib\xmlrpclib.py", line 1575, in __request
    verbose=self.__verbose
  File "C:\Python27\Lib\xmlrpclib.py", line 1264, in request
    return self.single_request(host, handler, request_body, verbose)
  File "C:\Python27\Lib\xmlrpclib.py", line 1297, in single_request
    return self.parse_response(response)
  File "C:\Python27\Lib\xmlrpclib.py", line 1462, in parse_response
    data = stream.read(1024)
  File "C:\Python27\Lib\httplib.py", line 541, in read
    return self._read_chunked(amt)
  File "C:\Python27\Lib\httplib.py", line 574, in _read_chunked
    line = self.fp.readline(_MAXLINE + 1)
  File "C:\Python27\Lib\socket.py", line 476, in readline
    data = self._sock.recv(self._rbufsize)
timeout: timed out

Storing complete log in C:\Users\reiner\AppData\Roaming\pip\pip.log

但是,另一个搜索命令可以顺利完成:

pip search django-registration

这是由于包含“ django”的大量软件包名称引起的pip错误吗?

注意: 高速互联网连接= 2 Mbits


阅读 114

收藏
2020-12-20

共1个答案

小编典典

--timeout选项似乎无法正常工作。

我可以使用以下任一方法正确安装django:

pip --default-timeout=60 install django

要么

export PIP_DEFAULT_TIMEOUT=60
pip install django

注意:在RHEL 6.3上使用pip版本1.2.1

资料来源:DjangoDay2012-Brescia.pdf,第11页

2020-12-20