【问题标题】:fatal error: numpy/arrayobject.h: No such file or directory #include "numpy/arrayobject.h" in google colab致命错误:numpy/arrayobject.h:没有这样的文件或目录#include "numpy/arrayobject.h" in google colab
【发布时间】:2021-02-14 02:10:41
【问题描述】:

您好,我正在尝试在 google colab 中运行 git repo, 我按照 git 指令安装了所有要求

在运行某个文件时出现此错误

致命错误:numpy/arrayobject.h:没有这样的文件或目录
#include "numpy/arrayobject.h"

我已经检查了这个错误的解决方案 但他们建议更改 setup.py 中的代码,但我在 google colab 中运行该文件,所以有人帮助我

我在 google colab 中运行的命令是

     !python build.py build_ext --inplace

我得到以下错误可以帮助我,我验证了 numpy 已经安装

    running build_ext
    skipping '_nms_gpu_post.c' Cython extension (up-to-date)
    building '_nms_gpu_post' extension
    creating build/temp.linux-x86_64-3.6
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c _nms_gpu_post.c -o build/temp.linux-x86_64-3.6/_nms_gpu_post.o
    _nms_gpu_post.c:485:10: fatal error: numpy/arrayobject.h: No such file or directory
     #include "numpy/arrayobject.h"
              ^~~~~~~~~~~~~~~~~~~~~
     compilation terminated.
     error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

【问题讨论】:

标签: python python-3.x numpy jupyter-notebook google-colaboratory


【解决方案1】:

我遇到了类似的问题,我通过编辑build.py解决了它:

ext_modules=[
        Extension("my_module", ["my_module.c"],
                  include_dirs=[numpy.get_include()]),
    ]

这里include_dirs=[numpy.get_include()] 是解决它所需的部分。

【讨论】:

    猜你喜欢
    • 2017-12-06
    • 2013-01-17
    • 1970-01-01
    • 2016-12-31
    • 1970-01-01
    • 1970-01-01
    • 2019-11-14
    • 2019-03-09
    相关资源
    最近更新 更多