致命错误:numpy/arrayobject.h:没有此类文件或目录 [英] fatal error: numpy/arrayobject.h: No such file or directory

查看:1477
本文介绍了致命错误:numpy/arrayobject.h:没有此类文件或目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的共享能力受到限制,因为这是我从Ubuntu 14.04移植到16.04的大量代码的一部分.

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.

这应该是微不足道的,但是以某种方式我正在为此而苦苦挣扎.在#include <numpy/arrayobject.h>

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>

我会尽我所能分享,看是否有人可以指导我解决问题.

I will try to share as much as I can, see if someone can guide me through a resolution.

$ 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

升级到

# 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

一些环境变量

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

错误

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

我的源文件

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...

磁盘上的声明文件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

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

已解决

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

推荐答案

在部分中断的Debian安装中,我也遇到了相同的行为.

I have experienced the same behavior on a partly broken Debian installation.

我通过重新建立符号链接来解决错误

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

这篇关于致命错误:numpy/arrayobject.h:没有此类文件或目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆