fatal error: numpy/arrayobject.h: No such file or directory
compilation terminated.
strong@foreverstrong:~$ python -c "import numpy; print(numpy.get_include())"
/usr/local/lib/python2.7/dist-packages/numpy/core/include
strong@foreverstrong:~$
strong@foreverstrong:~$ python-config --prefix
/usr
strong@foreverstrong:~$
strong@foreverstrong:~$ python-config --includes
-I/usr/include/python2.7 -I/usr/include/x86_64-linux-gnu/python2.7
strong@foreverstrong:~$
numpy/arrayobject.h
文件是 NumPy
的头文件。
python -c "import numpy; print(numpy.get_include())"
找不到的话,需要安装 NumPy。
python -c "import numpy; print(numpy.get_include())"
找到的话,在使用 numpy/arrayobject.h
文件的工程中,修改 Makefile 搜索路径。
# Python version
PYTHON_VERSION=2
ifeq ($(PYTHON_VERSION), 2)
PINCLUDE=$(shell python-config --includes)
COMMON+= $(PINCLUDE)
NPINCLUDE=$(shell python -c "import numpy; print(numpy.get_include())")
COMMON+= -I$(NPINCLUDE)
PLIB=$(shell python-config --libs)
LDFLAGS+= $(PLIB)
endif
# Python version
PYTHON_VERSION=3
ifeq ($(PYTHON_VERSION), 3)
PINCLUDE=$(shell python3-config --includes)
COMMON+= $(PINCLUDE)
NPINCLUDE=$(shell python3 -c "import numpy; print(numpy.get_include())")
COMMON+= -I$(NPINCLUDE)
PLIB=$(shell python3-config --libs)
LDFLAGS+= $(PLIB)
endif
https://yongqiang.blog.csdn.net/
https://blog.csdn.net/chengyq116/article/details/78491557