私のインストールでは、numpyarrayobject.h
は にあり…/site-packages/numpy/core/include/numpy/arrayobject.h
ます。numpy を使用する簡単な Cython スクリプトを作成しました。
cimport numpy as np
def say_hello_to(name):
print("Hello %s!" % name)
次のdistutilsもあります( Cythonユーザーガイドsetup.py
からコピー):
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
ext_modules = [Extension("hello", ["hello.pyx"])]
setup(
name = 'Hello world app',
cmdclass = {'build_ext': build_ext},
ext_modules = ext_modules
)
でビルドしようとするとpython setup.py build_ext --inplace
、Cython は次のことを試みます。
gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd \
-fno-common -dynamic -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DMACOSX \
-I/usr/include/ffi -DENABLE_DTRACE -arch i386 -arch ppc -pipe \
-I/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 \
-c hello.c -o build/temp.macosx-10.5-i386-2.5/hello.o
予想通り、これは を見つけられませんarrayobject.h
。distutils で numpy インクルード ファイルの正しい場所を使用するにはどうすればよいですか (ユーザーに $CFLAGS を定義させずに)。