在Spyder中导入模块

时间:2015-04-12 15:38:26

标签: python anaconda spyder

我正在尝试在spyder(anaconda)中导入一个名为pylearn2的库。我收到一个错误,找不到该模块。我试试from pylearn2 import models 我收到以下错误:

    from  pylearn2 import models
  File "pylearn2.py", line 1, in <module>
    from  pylearn2 import models
ImportError: cannot import name models

如果我输入import pylearn.,则intellisense包含所有选项,包括模型。

如果我打开ipython笔记本,我可以运行命令。

我使用Spyder的管理器添加了PYTHONPATH变量的各种级别的路径,但没有效果。知道为什么会这样吗?我通过conda和使用python 2.7更新了spyder。

编辑:其他信息:

命令import pylearn2似乎有效 spyder和ipython笔记本之间的pythonpath是相同的:

 '', '/home/jma/anaconda/lib/python2.7/site-packages/Lasagne-0.1.dev0-py2.7.egg',

'/home/jma/anaconda/lib/python2.7/site-packages/nolearn-0.6a0.dev0-py2.7.egg',

'/home/jma/anaconda/lib/python2.7/site-packages/joblib-0.8.4-py2.7.egg',

'/home/jma/anaconda/lib/python2.7/site-packages/argparse-1.3.0-py2.7.egg',

'/home/jma/anaconda/lib/python2.7/site-packages/pylearn2',

'/home/jma/anaconda/lib/python27.zip',

'/home/jma/anaconda/lib/python2.7',

'/home/jma/anaconda/lib/python2.7/plat-linux2',

'/home/jma/anaconda/lib/python2.7/lib-tk',

'/home/jma/anaconda/lib/python2.7/lib-old',

'/home/jma/anaconda/lib/python2.7/lib-dynload',

'/home/jma/anaconda/lib/python2.7/site-packages/runipy-0.1.1-py2.7.egg',

'/home/jma/anaconda/lib/python2.7/site-packages/setuptools-15.0-py2.7.egg',

'/home/jma/anaconda/lib/python2.7/site-packages',

'/home/jma/anaconda/lib/python2.7/site-packages/PIL',

'/home/jma/anaconda/lib/python2.7/site-packages/Sphinx-1.2.3-py2.7.egg',

'/home/jma/anaconda/lib/python2.7/site-packages/IPython/extensions

0 个答案:

没有答案