我正在尝试使用 IronPython 和 numpy 编写一些调用 .NET 程序集的代码。
版本信息:
numpy-2.0.0-1
scipy-1.0.0-2
铁Python 2.7.1
我根据此处给出的说明安装了 scipy 和 numpy:
http://www.enthought.com/repo/.iron/ http://www.enthought.com/repo/.iron/
当我尝试使用 ipy64.exe 运行时,我得到以下信息:
Failed while initializing NpyCoreApi: BadImageFormatException:An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000
B)
NumpyDotNet stack trace:
at NumpyDotNet.NpyCoreApi.GetNativeTypeInfo(Int32& intSize, Int32& longsize, Int32& longLongSize, Int32& longDoubleSize)
at NumpyDotNet.NpyCoreApi..cctor()
一切都通过 ipy.exe 运行。 IronPython 的当前版本 numpy 不兼容 64 位吗?
我正在调查的根本问题(可能与上述相关,也可能无关)涉及调用需要 System.Int64 作为参数的 .NET 程序集方法。 python 本机 int 工作正常,但是当使用 numpy.int32 (在 ipy.exe 下)调用时,隐式转换失败并显示:
E
======================================================================
ERROR: data_type_tests
System.Array[Int64](listValues)
TypeError: expected Int64, got numpy.int32
我正在执行的代码是:
values = array([1,2,3,4,5])
listValues = list(values);
System.Array[Int64](listValues)
如果我直接制作一个列表,即values = [1,2,3,4,5]
然后上面的运行。
关于将 numpy 数组转换为 32 位下的 System.Array[Int64] 的任何建议,或者对 IronPython 上 numpy 64 位支持状态的评论?