简体   繁体   English

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

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

I am limited on what I can share as this is part of a huge stack of code that I am porting from Ubuntu 14.04 to 16.04. 我受限于我可以分享的内容,因为这是我从Ubuntu 14.04移植到16.04的大量代码的一部分。

It should be trivial, but somehow I am struggling with this. 它应该是微不足道的,但不知何故,我正在努力解决这个问题。 It doesn't find numpy/arrayobject.h that I am referencing in my source file with #include <numpy/arrayobject.h> 它没有找到numpy/arrayobject.h ,我在我的源代码文件引用#include <numpy/arrayobject.h>

I will try to share as much as I can, see if someone can guide me through a resolution. 我将尝试尽可能多地分享,看看是否有人可以指导我完成决议。

Ubuntu Ubuntu的

$ lsb_release -a 
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.2 LTS
Release:    16.04
Codename:   xenial

make 使

$ make --version
GNU Make 4.1
Built for x86_64-pc-linux-gnu

g++ 克++

$ g++ --version
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609

upgraded to 升级到

# g++ --version
g++ (Ubuntu 5.4.1-2ubuntu1~16.04) 5.4.1 20160904
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

python 蟒蛇

$ python --version
Python 2.7.12

Some environment variables 一些环境变量

PYTHON       /usr/bin/python2.7
ARCH         x86_64
OS           Linux
VERSION      4.4.071generic
PLATFORM     linux2
HOSTNAME     deploy
USER         myUser
WUSS_BUILD   NO
CCVER        gcc
PYLIBDIR     build.x86_64-linux2
LIBDIR       build.x86_64-linux2
BINDIR       build.x86_64-linux2
ODIR         build.x86_64-linux2-gcc
STATICLIBDIR build-static.x86_64-linux2

Error 错误

The make command leads to make命令导致

+++ Compile mycore/boost_numpy.cc to build.x86_64-linux2-gcc
anycore/boost_numpy.cc:2:31: fatal error: numpy/arrayobject.h: No such file or directory

My source file 我的源文件

user@deploy:~/my-linux$ vim mycore/boost_numpy.cc

#include "anycore/boost_python_headers.h"
#include <numpy/arrayobject.h>           <====== DECLARATION
#include <numpy/ufuncobject.h>        
#include "mycore/boost_numpy.h"
#include "mycore/numerical.h"
#include "mycore/vec3.h"

using namespace boost::python;

PyObject *
read_numeric_file_ficii(FILE *fp, int ncols, char arrtype, int headlines, int taillines)
{
  if (!(arrtype=='d' || arrtype=='f' || arrtype=='i')) {
    PyErr_SetString(PyExc_ValueError, "Unknown array type for read_numeric_file");
    return NULL;
  }
...FILTERED...

Declaration file numpy/arrayobject.h on disk 声明文件numpy/arrayobject.h在磁盘上

root@deploy:/home#  find / -name arrayobject.h
/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h

Please let me know how I can improve the question. 请让我知道如何改进这个问题。 Directions or pointers are most welcome 方向或指示是最受欢迎的

UPDATE UPDATE

$ ls -l /usr/include/numpy
ls: cannot access '/usr/include/numpy': No such file or directory

RESOLVED WITH 已解决

sudo ln -s  /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy /usr/include/numpy

I have experienced the same behavior on a partly broken Debian installation. 我在部分破坏的Debian安装上遇到了相同的行为。

I fixed the error by reestablishing a symbolic link 我通过重新建立符号链接来修复错误

sudo ln -s /usr/lib/python2.7/dist-packages/numpy/core/include/numpy /usr/include/numpy

How did you install numpy? 你是怎么安装numpy的?

If you install python-numpy correctly, eg by sudo apt-get install python-numpy , you will have /usr/include/numpy linked to the correct path: 如果正确安装python-numpy ,例如通过sudo apt-get install python-numpy ,你将/usr/include/numpy链接到正确的路径:

$ ls -l /usr/include/numpy
lrwxrwxrwx 1 root root 55 Sep 17  2014 /usr/include/numpy -> ../lib/python2.7/dist-packages/numpy/core/include/numpy

It looks like you may build your numpy manually, then you can manually create a soft link accordingly. 看起来你可以手动构建你的numpy,然后你可以相应地手动创建一个软链接。

暂无
暂无

声明:本站的技术帖子网页,遵循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" cimport给出致命错误:找不到“ numpy / arrayobject.h”文件 - cimport gives fatal error: 'numpy/arrayobject.h' file not found 如何解决这个致命错误:numpy/arrayobject.h:没有这样的文件或目录? - How do I resolve this make fatal error: numpy/arrayobject.h: No such file or directory? 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 相当于使用#include <Numeric/arrayobject.h> 在Numpy - equivalent of using #include <Numeric/arrayobject.h> in Numpy 将 numpy 的 arrayobject.h 包含到 bitbake 配方中 - 如何修复安装顺序? - Include numpy's arrayobject.h into bitbake recipe - how to fix installation order? 在Windows中编译SWIG python包装程序时,MinGW g ++找不到numpy \\ arrayobject.h - numpy\arrayobject.h not find by MinGW g++ while compiling SWIG python wrapper in Windows
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM