确保系统 PYTHONPATH 包含站点包文件夹,当您从 virtualenv 中选择 python 解释器时。就像快照一样。
然后,您不需要将它们一个接一个地添加到PYTHONPATH中。您将需要重新启动日食(刷新不起作用)。将添加新模型。
更新:我在virtualenv中检查了PYTHONPATH。我发现在sys.path中还有其他一些路径。它们是系统默认的 python 安装位置。这些路径包括基本模型,如 和 。copy
json
PS:我的环境是Max OSX 10.8。请通过以下方式检查您自己平台的输出print sys.path
/Users/username/.virtualenvs/test/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg
/Users/username/.virtualenvs/test/lib/python2.7/site-packages/pip-1.1-py2.7.egg
/Users/username/.virtualenvs/test/lib/python27.zip
/Users/username/.virtualenvs/test/lib/python2.7
/Users/username/.virtualenvs/test/lib/python2.7/plat-darwin
/Users/username/.virtualenvs/test/lib/python2.7/plat-mac
/Users/username/.virtualenvs/test/lib/python2.7/plat-mac/lib-scriptpackages
/Users/username/.virtualenvs/test/lib/python2.7/lib-tk
/Users/username/.virtualenvs/test/lib/python2.7/lib-old
/Users/username/.virtualenvs/test/lib/python2.7/lib-dynload
/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin
/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk
/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac
/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages
/Users/username/.virtualenvs/test/lib/python2.7/site-packages
我认为这是virtualenv的要求。您需要将这些路径添加到pydev系统PYTHONPATH中。然后,您可以使用这些基本模块。