Python - 无法在spyder中导入slycot模块(RuntimeError& ImportError)

时间:2013-05-24 18:01:06

标签: python importerror spyder

当我尝试在spyder(版本2.2)中导入slycot模块时,出现以下错误:

RuntimeError: module compiled against API version 7 but this version of numpy is 6
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Applications/Spyder.app/Contents/Resources/lib/python2.7/slycot/__init__.py",  
line 4, in <module>
    from slycot.analysis import ab01nd,ab05md,ab05nd,ab07nd,ab08nd, ab09ad
  File "/Applications/Spyder.app/Contents/Resources/lib/python2.7/slycot/analysis.py",
line 21, in <module>
    from slycot import _wrapper
ImportError: numpy.core.multiarray failed to import

现在,当我通过终端在python shell中导入slycot时,根本没有问题。我认为通过终端没有问题的原因是我最近安装了numpy 1.7.1。另一方面,Spyder仍然使用numpy 1.6.2。因此错误。

我试图改变spyder中的numpy版本,但到目前为止还没有用。 当我用最近安装的numpy(7)更改我的spyder lib中的numpy(6)文件夹时,我收到以下错误(在spyder中):

ImportError: Error importing numpy: you should not try to import numpy from
    its source directory; please exit the numpy source tree, and relaunch
    your python intepreter from there.

解决此错误的最佳方法是什么?

提前致谢。

1 个答案:

答案 0 :(得分:1)

(Spyder dev here)目前,用户无法在应用程序内安装任何内容。我猜你把你的slycot模块从另一个解释器移到了我们的App(因为你提到的numpy错误。)

使用应用程序中不存在的不同模块的正确方法是更改​​解释器的路径:

工具&gt;偏好&gt;控制台&gt;高级设置&gt; Python可执行文件

如果您使用系统Python安装了slycot,则必须选择

/usr/bin/python