从virtualenv中选择python解释器时,请确保系统PYTHONPATH包括site-packages文件夹。就像快照一样。
然后,您不需要将它们一个接一个地添加到PYTHONPATH中。您将需要重新启动Eclipse(“刷新”无效)。新模型将被添加。
更新:我在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中。然后,您可以使用这些基本模块。



