等效于使用#include< Numeric/arrayobject.h>在Numpy中 [英] equivalent of using #include <Numeric/arrayobject.h> in Numpy

查看:142
本文介绍了等效于使用#include< Numeric/arrayobject.h>在Numpy中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一段旧代码,它使用了Numeric,我想将其与numpy交换.

I have an old piece of code and it uses Numeric and I wanted to swap that with numpy.

也有一些使用以下代码的C代码:

There is some C code too that uses the following:

    #include <Numeric/arrayobject.h>

我想使用Numpy进行同样的操作,有没有办法做到这一点?

I want to do the same using Numpy, is there a way to do this?

推荐答案

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

So if anyone is interested -to continue to use arrayobject.h like in the old Numeric system

执行以下操作:

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

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

But the new arrayobject.h is in a different location to Numeric so update the setup.py as follows:

添加以下内容

     import numpy as NU

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

Then under setup (still in setup.py) add the following

    include_dirs = [NU.get_include()], 

这篇关于等效于使用#include&lt; Numeric/arrayobject.h&gt;在Numpy中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆