【发布时间】:2022-01-03 16:25:27
【问题描述】:
我是 C 和 Python 中的 ctypes 的新手。
我需要将指向双精度数组的 C 指针转换为 Python numpy 数组。
我的出发点如下:
import ctypes
import numpy as np
arrayPy = np.array([[0, 1, 2], [3, 4, 5]])
out_c = arrayPy.ctypes.data_as(ctypes.POINTER(ctypes.c_double))
请问如何有效地将“out_c”对象转换为 Python numpy 数组?
【问题讨论】:
标签: python arrays c numpy ctypes