简体   繁体   English

PyDev未解决的导入与sklearn

[英]PyDev unresolved import with sklearn

I'm running PyDev in Eclipse 4.2 on Mountain Lion. 我正在Mountain Lion的Eclipse 4.2中运行PyDev。 I installed the SciPy Superpack , and can use all the packages -- including Scikit-learn and MatPlotLib -- in the Python interpreter and through IPython. 我安装了SciPy Superpack ,并且可以在Python解释器中和通过IPython使用所有软件包-包括Scikit-learn和MatPlotLib。 However, when I try to import them in PyDev I get an 'Unresolved import' error. 但是,当我尝试在PyDev中导入它们时,出现“未解决的导入”错误。

I installed Python 2.7.3 from Python.org, and verified that PyDev is pointing to the correct interpreter. 我从Python.org安装了Python 2.7.3,并确认PyDev指向正确的解释器。 I also attempted to add the sklearn and matplotlib directories (verified via the path from sklearn.__file__ ) to the System PYTHONPATH in the PyDev settings. 我还尝试将sklearn和matplotlib目录(通过sklearn.__file__的路径验证)添加到PyDev设置中的System PYTHONPATH中。 This didn't resolve the issue. 这不能解决问题。

Any idea what else I should try? 知道我还要尝试什么吗?

From your comment examples, seems the path you are using is at the wrong depth. 从您的注释示例看来,您使用的路径似乎有误。

Change from: 更改自:
/Library/Python/2.7/site-packages/scikit_learn-0.12_git-py2.7-macosx-10.8-intel‌​.egg/sklearn

To: 至:
/Library/Python/2.7/site-packages/scikit_learn-0.12_git-py2.7-macosx-10.8-intel‌​.egg

It wasn't able to find the package level name because you were specifying beneath it. 无法找到包级别名称,因为您正在其下方指定。 Normally a python interpreter will resolve all the eggs by simply existing insite the site-packages, from the `.pth' file references that get placed there. 通常,一个python解释器将通过放置在站点文件中的.pth文件引用中的站点包来简单地解决所有鸡蛋。 But I think pyDev will need explicit adding of those eggs to the PYTHONPATH. 但是我认为pyDev需要将这些鸡蛋显式添加到PYTHONPATH中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM