在MBP上,按照说明(http://techblog.rosedu.org/python-environment.html),我安装了Xcode 4.4.1,brew(brew医生说所有设置),然后是python。接下来,我尝试设置virtualenv:
> $MYPYTHON/bin/python distribute_setup.py
> $MYPYTHON/bin/easy_install pip
> $MYPYTHON/bin/pip install virtualenv
然后我创建了一个虚拟环境并尝试安装django:
> $MYPYTHON/bin/virtualenv $MYENV
> $MYENV/bin/pip install Django
下载98%,然后挂起一段时间,最后我得到一个指示超时的追踪:
pcm@pcm-mac[302]% $MYENV/bin/pip install django
Downloading/unpacking django
Downloading Django-1.4.1.tar.gz (7.7Mb): 7.5Mb downloaded
Exception:
Traceback (most recent call last):
File "/Users/pcm/Documents/workspace/virtual/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/basecommand.py", line 104, in main
status = self.run(options, args)
File "/Users/pcm/Documents/workspace/virtual/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/commands/install.py", line 245, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/Users/pcm/Documents/workspace/virtual/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 985, in prepare_files
self.unpack_url(url, location, self.is_download)
File "/Users/pcm/Documents/workspace/virtual/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 1109, in unpack_url
retval = unpack_http_url(link, location, self.download_cache, self.download_dir)
File "/Users/pcm/Documents/workspace/virtual/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/download.py", line 451, in unpack_http_url
download_hash = _download_url(resp, link, temp_location)
File "/Users/pcm/Documents/workspace/virtual/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/download.py", line 368, in _download_url
chunk = resp.read(4096)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 380, in read
data = self._sock.recv(left)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 553, in read
s = self.fp.read(amt)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 380, in read
data = self._sock.recv(left)
timeout: timed out
我看到同样的事情,如果我只是从/ usr / local / bin /运行pip的版本。我尝试了其他软件包(selenium,mock),他们下载并安装得很好。
我不知道自己可能做错了什么,或者是否存在django通过pip安装的问题。建议?
答案 0 :(得分:11)
使用:
pip --default-timeout=60 install django