My Cython code parses into C, but doesn't comp

2019-09-05 07:05发布

问题:

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.