Python 编译cython.pyx文件时出错

Python 编译cython.pyx文件时出错,python,compilation,cython,ipython-notebook,Python,Compilation,Cython,Ipython Notebook,我是cython的新手,目前正在学习它 我有一个.pyx文件,当我试图使用ipython笔记本中的distutils模块编译它时,使用ff。代码: from distutils.core import setup from Cython.Build import cythonize setup( name = "functions_cython", ext_modules = cythonize('../utils/cython_func.pyx'), # accepts a

我是cython的新手,目前正在学习它

我有一个.pyx文件,当我试图使用ipython笔记本中的distutils模块编译它时,使用ff。代码:

from distutils.core import setup
from Cython.Build import cythonize

setup(
    name = "functions_cython",
    ext_modules = cythonize('../utils/cython_func.pyx'), # accepts a glob pattern
)
我得到了以下错误:

An exception has occurred, use %tb to see the full traceback.

SystemExit: usage: __main__.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: __main__.py --help [cmd1 cmd2 ...]
   or: __main__.py --help-commands
   or: __main__.py cmd --help

error: option -f not recognized
当我尝试以另一种方式使用
python setup.py build\u ext--inplace
setup.py
中存储的相同代码编译它时,我得到了以下错误:

build_ext --inplace
Compiling cython_func.pyx because it changed.
Cythonizing cython_func.pyx
running build_ext
building 'utils.cython_func' extension
creating build
creating build/temp.macosx-10.10-x86_64-2.7
clang -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c cython_func.c -o build/temp.macosx-10.10-x86_64-2.7/cython_func.o
cython_func.c:239:10: fatal error: 'numpy/arrayobject.h' file not found
#include "numpy/arrayobject.h"
     ^
1 error generated.
error: command 'clang' failed with exit status 1
如何解决编译问题

另一个问题,根据cython文档,cython代码必须编译,不像python代码,为什么会这样


(这样做的目的是我应该能够将
.pyx
文件导入ipython笔记本。)

我能够通过在安装程序中添加另一个参数
include\u dirs=[numpy.get\u include()])
来解决未找到的文件错误
'numpy/arrayobject.h'

只是发布,以便其他人可以参考这些类型的错误