无法使用pip安装Django

时间:2016-04-06 08:06:54

标签: python django installation pip

我已经针对此错误进行了大量研究,但找不到可以解决我的问题的

我在Ubuntu 14.04上使用虚拟环境中的pip安装Django 1.9。我的python版本是3.4.0。我已经尝试过很多解决方案,比如使用而不是使用 sudo

python -m pip install -U --force-reinstall pip

但没有任何对我有用。 这是我的错误。

(myvenv)surpsi@Lord-of-Codes:~$ sudo pip install django
[sudo] password for surpsi: 
Downloading/unpacking django
  Downloading Django-1.9.5-py2.py3-none-any.whl (6.6MB): 1.4MB downloaded
Cleaning up...
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1198, in prepare_files
    do_download,
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1376, in unpack_url
    self.session,
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 572, in unpack_http_url
    download_hash = _download_url(resp, link, temp_location)
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 433, in _download_url
    for chunk in resp_read(4096):
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 421, in resp_read
    chunk_size, decode_content=False):
  File "/usr/share/python-wheels/urllib3-1.7.1-py2.py3-none-any.whl/urllib3/response.py", line 225, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "/usr/share/python-wheels/urllib3-1.7.1-py2.py3-none-any.whl/urllib3/response.py", line 174, in read
    data = self._fp.read(amt)
  File "/usr/lib/python2.7/httplib.py", line 573, in read
    s = self.fp.read(amt)
  File "/usr/lib/python2.7/socket.py", line 380, in read
    data = self._sock.recv(left)
  File "/usr/lib/python2.7/ssl.py", line 341, in recv
    return self.read(buflen)
  File "/usr/lib/python2.7/ssl.py", line 260, in read
    return self._sslobj.read(len)
SSLError: The read operation timed out

Storing debug log for failure in /home/surpsi/.pip/pip.log

1 个答案:

答案 0 :(得分:0)

pip --default-timeout=100 install django

您可以覆盖默认超时,尝试使用上面的命令。积分转至https://stackoverflow.com/a/19334551/903790