PTVS 和 numpy System.Int64 转换中的 numpy 64 位支持
我正在尝试使用 IronPython 和 numpy 编写一些调用 .NET 程序集的代码。 版本信息: numpy-2.0.0-1 scipy-1.0.0-2 IronPython 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)
如果我直接创建一个列表,即 value = [1,2,3, 4,5] 然后上面的运行。
关于将 numpy 数组转换为 32 位下的 System.Array[Int64] 的任何建议,或者对 IronPython 上 numpy 64 位支持状态的评论?
I am trying to write some code with IronPython and numpy that calls a .NET assembly.
Version info:
numpy-2.0.0-1
scipy-1.0.0-2
IronPython 2.7.1
I installed scipy and numpy according to the instructions given here:
http://www.enthought.com/repo/.iron/
When I try to run with ipy64.exe I get the following:
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()
Everything runs with ipy.exe. Is the current version of numpy for IronPython not 64-bit compatible?
The root problem I am investigating (may or may not be related to above) involves invoking a .NET assembly method that requires a System.Int64 as an argument. The python native int works fine but when invoking with a numpy.int32 (under ipy.exe) the implicit cast fails with:
E
======================================================================
ERROR: data_type_tests
System.Array[Int64](listValues)
TypeError: expected Int64, got numpy.int32
The code I am executing is:
values = array([1,2,3,4,5])
listValues = list(values);
System.Array[Int64](listValues)
If I make a list directly, i.e. values = [1,2,3,4,5]
then the above runs.
Any suggestions on converting the numpy array to a System.Array[Int64] under 32 bit or comments on the state of the numpy 64 bit support on IronPython?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我需要的是:
list() 方法将保留每个元素的包装。这个论坛帖子有我正在寻找的答案: http://www.python-forum.org/pythonforum/viewtopic.php?f=3&t=2962&p=12102
我仍然很好奇64 位 numpy 支持吗?
What I needed was:
the list() method will keep each element wrapped. This forum post had the answer I was looking for: http://www.python-forum.org/pythonforum/viewtopic.php?f=3&t=2962&p=12102
I am still curious about the 64bit numpy support though?