Tag: scipy

来自C#(使用SciPy)的IronPython调用因ImportException失败:“没有名为mtrand的模块”

我有一个python库,我试图通过IronPython(v2.7 RC1 [2.7.0.30])从C#应用程序调用。 该库非常广泛地使用NumPy和SciPy,当从命令行使用ipy运行时,它可以与SciPy和NumPy for .NET一起使用,如下所示: ipy.exe -X:Frames file_from_lib_importing_numpy.py 但是,当我使用下面的代码从C#调用IronPython时,会抛出exception: ImportException “No module named mtrand” at Microsoft.Scripting.Runtime.LightExceptions.CheckAndThrow(Object value) at IronPython.Runtime.Operations.PythonOps.ImportStar(CodeContext context, String fullName, Int32 level) at Microsoft.Scripting.Interpreter.ActionCallInstruction3.Run(InterpretedFrame frame) … at Microsoft.Scripting.SourceUnit.Execute(Scope scope, ErrorSink errorSink) at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope) at Microsoft.Scripting.Hosting.ScriptEngine.ExecuteFile(String path) at Microsoft.Scripting.Hosting.ScriptRuntime.ExecuteFile(String path) at Microsoft.Scripting.Hosting.ScriptRuntime.UseFile(String path) … 调用IronPython的C#代码(它的一部分)如下: ScriptEngine _engine; var opts = new Dictionary(); […]