numpy/arrayobject.h”: No such file or directory

来源:互联网 发布:一般约束的最优化问题 编辑:程序博客网 时间:2024/06/18 18:28

numpy/arrayobject.h”: No such file or directory




In your setup.py, the Extension should have the argument include_dirs=[numpy.get_include()].

Also, you are missing np.import_array() in your code.

--

Example setup.py:

from distutils.core import setup, Extensionfrom Cython.Build import cythonizeimport numpysetup(    ext_modules=[        Extension("my_module", ["my_module.c"],                  include_dirs=[numpy.get_include()]),    ],)# Or, if you use cythonize() to make the ext_modules list,# include_dirs can be passed to setup()setup(    ext_modules=cythonize("my_module.pyx"),    include_dirs=[numpy.get_include()])    

In your setup.py, the Extension should have the argument include_dirs=[numpy.get_include()].

Also, you are missing np.import_array() in your code.

--

Example setup.py:

from distutils.core import setup, Extensionfrom Cython.Build import cythonizeimport numpysetup(    ext_modules=[        Extension("my_module", ["my_module.c"],                  include_dirs=[numpy.get_include()]),    ],)# Or, if you use cythonize() to make the ext_modules list,# include_dirs can be passed to setup()setup(    ext_modules=cythonize("my_module.pyx"),    include_dirs=[numpy.get_include()])    
原创粉丝点击