2013-09-23 32 views
15

時每當我試着用pip我碰到下面的錯誤安裝的東西:「SSLError:讀操作超時」使用PIP

Downloading/unpacking Django>=1.5.1,<1.6 (from -r requirements.txt (line 1)) 
  Downloading Django-1.5.4.tar.gz (8.1MB): 8.0MB downloaded 
Cleaning up... 
Exception: 
Traceback (most recent call last): 
  File "/vagrant/venv/local/lib/python2.7/site-packages/pip/basecommand.py", line 134, in main 
    status = self.run(options, args) 
  File "/vagrant/venv/local/lib/python2.7/site-packages/pip/commands/install.py", line 236, in run 
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle) 
  File "/vagrant/venv/local/lib/python2.7/site-packages/pip/req.py", line 1092, in prepare_files 
    self.unpack_url(url, location, self.is_download) 
  File "/vagrant/venv/local/lib/python2.7/site-packages/pip/req.py", line 1238, in unpack_url 
    retval = unpack_http_url(link, location, self.download_cache, self.download_dir) 
  File "/vagrant/venv/local/lib/python2.7/site-packages/pip/download.py", line 622, in unpack_http_url 
    download_hash = _download_url(resp, link, temp_location) 
  File "/vagrant/venv/local/lib/python2.7/site-packages/pip/download.py", line 495, in _download_url 
    chunk = resp.read(4096) 
  File "/usr/lib/python2.7/socket.py", line 380, in read 
    data = self._sock.recv(left) 
  File "/usr/lib/python2.7/httplib.py", line 561, 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 241, in recv 
    return self.read(buflen) 
  File "/usr/lib/python2.7/ssl.py", line 160, in read 
    return self._sslobj.read(len) 
SSLError: The read operation timed out 

Storing complete log in /home/vagrant/.pip/pip.log

這過去時常發生在我的時間,但現在我無法安裝任何東西。我嘗試添加--timeout=600,但在相同的時間內(達到8.0M後幾秒)失敗。
關於如何解決這個問題的任何想法?

+0

您是否使用自己的PyPI鏡像或任何類型的代理服務器? –

+0

不是。在常規服務器上使用即用即用即用即用即用即用即用即用服務器。 –

+0

這隻發生在一臺電腦上?如果是的話,爲什麼不嘗試找出它試圖獲取哪個URL,並看看它上面的curl -O' /'wget'工作正常。 –

回答

0

使用sudo pip install解決了我的問題(在我的本地計算機上)。我知道這個問題很古老,但對於將來遇到這種麻煩的任何人來說,這是我的工作。 :)

8

這通常是因爲互聯網連接弱,即;在安裝過程中丟失互聯網連接重做命令,它應該工作正常。