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

2019-09-05 06:29发布

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.

2条回答
兄弟一词,经得起流年.
2楼-- · 2019-09-05 07:03

assuming you have installed numpy in your system ...

in your setup.py you have to write :

import numpy 
...
Extension(..., include_dirs = [numpy.get_include(), ... ] )
查看更多
你好瞎i
3楼-- · 2019-09-05 07:07

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

查看更多
登录 后发表回答