繁体   English   中英

无法导入scipy,但可以在IronPython中导入numpy

[英]Unable to import scipy but can import numpy in IronPython

我试图将我的代码从Python(v2.7)移植到IronPython以便能够利用我在实验室计算机上可以使用的多个内核。

我首先从以下网址安装了IronPythonhttp//ironpython.net/

然后我按照此处给出的说明安装(或至少我认为有)软件包numpyscipyhttps : scipy
我还尝试了页面上给出的最后一条命令( > ipy -X:Frames -c "import scipy" ),并且由于命令提示符未吐出错误,因此我认为一切正常。

但奇怪的是,我可以导入numpy但不能导入scipy 以下是我收到的错误消息:

IronPython 2.7.4 (2.7.0.40) on .NET 4.0.30319.18444 (32-bit)
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> np.pi
3.141592653589793
>>> import scipy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\scipy\__init__.p
y", line 124, in <module>
  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\numpy\_import_to
ols.py", line 15, in __init__
AttributeError: 'module' object has no attribute '_getframe'

我在这里错过了什么? 我在Google上搜索了AttributeError: 'module' object has no attribute '_getframe' ,但是找不到解决我问题的方法。

您是否尝试过使用交互式窗口? 您可以像这样添加“ -X:Frames”

1. Go to: Tools -> Options -> Python Tools -> Interactive Windows -> IronPython 2.7

2. Set "Interpreter Options" to "-X:Frames"

另外,在运行此命令时,请检查-X:Frames是否在输出中

PS> ( Get-WmiObject Win32_Process -Filter "Name like '%ipy%'" ).CommandLine

如果不是,则“ -X:Frames”出问题了。

暂无
暂无

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

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