1、参考https://cython.readthedocs.io/en/latest/src/tutorial/cython_tutorial.html
以bbox.pyx为例,先新建setup.py,内容为
from distutils.core import setup
from Cython.Build import cythonize
setup(
ext_modules = cythonize("bbox.pyx")
)
然后执行命令
python setup.py build_ext --inplace
在自动执行以下命令时
gcc -pthread -B /home/Shaelyn/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/Shaelyn/anaconda3/include/python3.7m -c bbox.c -o build/temp.linux-x86_64-3.7/bbox.o
发生错误
bbox.c:626:31: fatal error: numpy/arrayobject.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit stat