我正在尝试用IronPython和numpy编写一些调用.NET程序集的代码。版本信息:numpy-2.0.0-1scipy-1.0.0-2IronPython 2.7.1
我根据这里给出的说明安装了scipy和numpy:
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)
如果我直接列出一个列表,即值=[1,2,3,4,5]则以上运行。
有没有关于将numpy数组转换为32位以下的System.array[Int64]的建议,或者对IronPython上numpy 64位支持的状态的评论?
我需要的是:
listValues.tolist() instead of list(listValues)
list()方法将保持每个元素的包装。这个论坛帖子有我想要的答案:http://www.python-forum.org/pythonforum/viewtopic.php?f=3&t=2962&p=12102
不过,我仍然对64位numpy支持感到好奇?