我的Cython代码解析为C,但无法编译。第一次尝试使用外部C代码 [英] My Cython code parses into C, but doesn't compile. First time trying to use external C code

查看:63
本文介绍了我的Cython代码解析为C,但无法编译。第一次尝试使用外部C代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编译以下代码:

I am trying to compile this code:

interp3d.pyx

以及此处提供的库:

Interpolate3D

它经过cython-> C阶段没有任何错误,但是gcc出现了一些错误:

It gets past the cython -> C stage without any errors, but there's a crapton of errors with gcc:

编译-时间错误-不知道是否有帮助

编译错误摘录:

gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -O2 -I/home/jordango/Desktop/epd-7.0-2-rh5-x86/include -fPIC -I/home/jordango/Desktop/epd-7.0-2-rh5-x86/include/python2.7 -c interp3d.c -o build/temp.linux-i686-2.7/interp3d.o
interp3d.c:225:31: error: numpy/arrayobject.h: No such file or directory
interp3d.c:226:31: error: numpy/ufuncobject.h: No such file or directory

如果有人可以帮助我弄清楚我在做什么错,那真是太棒了。很难知道像C一样,Python一样。

If someone could help me figure out what I'm doing wrong here, that would be awesome. It's sort of hard to know what to make look like C and what to make look like Python.

如果有帮助,我正在使用Cython 0.14.1。

If it helps, I'm using Cython 0.14.1.

谢谢。

推荐答案

假设您已在系统中安装了numpy ...

assuming you have installed numpy in your system ...

在您的setup.py中,您必须编写:

in your setup.py you have to write :

import numpy 
...
Extension(..., include_dirs = [numpy.get_include(), ... ] )

这篇关于我的Cython代码解析为C,但无法编译。第一次尝试使用外部C代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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