当前位置: 首页 > 工具软件 > Object Shell > 使用案例 >

fatal error: numpy/arrayobject.h: No such file or directory

秦承安
2023-12-01

fatal error: numpy/arrayobject.h: No such file or directory

1. fatal error: numpy/arrayobject.h: No such file or directory

fatal error: numpy/arrayobject.h: No such file or directory
compilation terminated.

2. python -c “import numpy; print(numpy.get_include())”

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 搜索路径。

3. NPINCLUDE

# 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

References

https://yongqiang.blog.csdn.net/
https://blog.csdn.net/chengyq116/article/details/78491557

 类似资料:

相关阅读

相关文章

相关问答