简体   繁体   English

如何解决这个致命错误:numpy/arrayobject.h:没有这样的文件或目录?

[英]How do I resolve this make fatal error: numpy/arrayobject.h: No such file or directory?

I have the following snippet in my makefile (the first line was added by me after finding it as a candidate solution online - unfortunately, it doesn't work):我的makefile中有以下代码段(第一行是我在网上找到它作为候选解决方案后添加的 - 不幸的是,它不起作用):

$(shell set(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS} /usr/local/lib/python3.5/dist-packages/numpy/core/include))

all: obj $(EXEC) link
$(EXEC): $(OBJS)
    $(CC) $(COMMON) -I./src/factor $(CFLAGS) $^ -o $@ $(LDFLAGS)
    $(CC) -shared $(COMMON) -I./src/factor $(CFLAGS) $^ -o $(SHAREDLIB) $(LDFLAGS)
$(OBJDIR)%.o: %.c $(DEPS)
    $(CC) $(COMMON) -I./src/factor $(CFLAGS) -c $< -o $@

I verified that numpy/arrayobject.h is in /usr/local/lib/python3.5/dist-packages/numpy/core/include on my system.我验证了numpy/arrayobject.h在我的系统上的/usr/local/lib/python3.5/dist-packages/numpy/core/include中。 After executing make I get:执行make后,我得到:

gcc -I ./include -I/usr/include/python3.5 -DGPU -I/usr/local/cuda-10.0/include/ -DCUDNN  -I./src/factor -Wall -Wfatal-errors -fPIC -Ofast -DGPU -DCUDNN -c ./src/ComputationPy.c -o obj/ComputationPy.o
./src/ComputationPy.c:12:31: fatal error: numpy/arrayobject.h: No such file or directory
compilation terminated.
Makefile:51: recipe for target 'obj/ComputationPy.o' failed
make: *** [obj/ComputationPy.o] Error 1

Line 51 corresponds to the last line of the snippet.第 51 行对应于代码段的最后一行。

Without seeing the complete Makefile it's hard to be sure what's wrong, but this line looks like it can't possibly be correct:没有看到完整的 Makefile 很难确定出了什么问题,但这条线看起来不可能是正确的:

$(shell set(PYTHON_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS} /usr/local/lib/python3.5/dist-packages/numpy/core/include))

In GNU make, $(shell...) runs sh -c "..." [technically, $(SHELL) -c "..." ) and evaluates to whatever that command prints on its stdout.在 GNU make 中, $(shell...)运行sh -c "..." [技术上, $(SHELL) -c "..." ) 并评估该命令在其标准输出上打印的任何内容。 set(...) is not valid sh syntax, and also, the stuff inside $(shell...) cannot change Make variables. set(...)不是有效的 sh 语法,而且$(shell...)里面的东西不能改变 Make 变量。 I would expect this line to print an error message as part of the make log, something like我希望这一行会打印一条错误消息作为 make 日志的一部分,例如

sh: 1: Syntax error: word unexpected (expecting ")")

and otherwise have no effect.否则无效。

Assuming the goal here is to append /usr/local/lib/python3.5/dist-packages/numpy/core/include to the value of the Make variable PYTHON_INCLUDE_DIRS , the way to do that is with += :假设这里的目标是 append /usr/local/lib/python3.5/dist-packages/numpy/core/include到 Make 变量PYTHON_INCLUDE_DIRS的值,这样做的方法是使用+=

PYTHON_INCLUDE_DIRS += /usr/local/lib/python3.5/dist-packages/numpy/core/include

The rules you quoted don't directly make use of this variable, but I suspect there may be a reference to it hiding inside $(COMMON) .您引用的规则不直接使用此变量,但我怀疑可能在$(COMMON)中隐藏了对它的引用。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 致命错误:numpy/arrayobject.h:google colab 中没有这样的文件或目录#include“numpy/arrayobject.h” - fatal error: numpy/arrayobject.h: No such file or directory #include "numpy/arrayobject.h" in google colab Cython:“致命错误:numpy/arrayobject.h:没有这样的文件或目录” - Cython: "fatal error: numpy/arrayobject.h: No such file or directory" 致命错误:numpy / arrayobject.h:没有这样的文件或目录 - fatal error: numpy/arrayobject.h: No such file or directory cimport给出致命错误:找不到“ numpy / arrayobject.h”文件 - cimport gives fatal error: 'numpy/arrayobject.h' file not found Cython:致命错误:未找到“numpy/arrayobject.h”文件,使用 numpy - Cython: fatal error: 'numpy/arrayobject.h' file not found, using numpy 致命错误:使用 pyenv 时找不到“arrayobject.h”文件 - fatal error: 'arrayobject.h' file not found when using pyenv 编译.pyx文件时缺少numpy / arrayobject.h - Missing numpy/arrayobject.h while compiling .pyx file 将 numpy 的 arrayobject.h 包含到 bitbake 配方中 - 如何修复安装顺序? - Include numpy's arrayobject.h into bitbake recipe - how to fix installation order? 相当于使用#include <Numeric/arrayobject.h> 在Numpy - equivalent of using #include <Numeric/arrayobject.h> in Numpy 如何使用C将数据从np.array获取到std :: vector <numpy/arrayobject.h> ? - How to get data from np.array to std::vector in c++ using <numpy/arrayobject.h>?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM