My Cython code parses into C, but doesn't compile. First time trying to use external C code

泪湿孤枕 提交于 2020-01-06 12:55:14

问题


I am trying to compile this code:

interp3d.pyx

along with the library provided here:

Interpolate3D

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

Compile-time errors---dunno if this helps or not

Excerpt from compile errors:

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

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.

If it helps, I'm using Cython 0.14.1.

Thanks.


回答1:


assuming you have installed numpy in your system ...

in your setup.py you have to write :

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



回答2:


It looks like there's an unsatisfied dependency on numpy, judging by the "No such files" errors.



来源:https://stackoverflow.com/questions/6525161/my-cython-code-parses-into-c-but-doesnt-compile-first-time-trying-to-use-exte

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!