python - 相当于在 Numpy 中使用 #include <Numeric/arrayobject.h>

标签 python c numpy scipy numeric

我有一段旧代码,它使用 Numeric,我想用 numpy 交换它。

也有一些 C 代码使用了以下内容:

    #include <Numeric/arrayobject.h>

我想用 Numpy 做同样的事情,有没有办法做到这一点?

最佳答案

因此,如果有人有兴趣继续使用 arrayobject.h,就像在旧的数字系统中一样

执行以下操作:

      Replace <Numeric/arrayobject.h> with <numpy/arrayobject.h>

但新的 arrayobject.h 与 Numeric 位于不同的位置,因此更新 setup.py 如下:

添加以下内容

     import numpy as NU

然后在 setup 下(仍在 setup.py 中)添加以下内容

    include_dirs = [NU.get_include()], 

关于python - 相当于在 Numpy 中使用 #include <Numeric/arrayobject.h>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19236121/

相关文章:

Python 优化 - 调用迭代函数会显着减慢我的程序速度吗?

C 链表集(抽象数据类型)

c - 为什么 cstdlib strncpy 在将 char 数组复制到字符指针时崩溃

c - 如何定义和 typedef 一个包含指向自身的指针的结构?

python - 使用numpy根据固定映射将巨大的2字节字符串数组转换为相应的1字节字符串

python - 有没有更快的方法在一维数组中将 "0"随机交换为 "1"?

python - numpy.arrays 中的字符串预分配

python - 对于 np.array([1, 2, 3]) 为什么形状是 (3,) 而不是 (3,1)?

python - 用于 attrs 的 Pycharm 插件?

python - 加粗一个像素线