Python Caffe编译时没有看到hdf5.h

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37007495/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 18:41:03  来源:igfitidea点击:

Caffe didn't see hdf5.h when compiling

pythondeep-learningcaffe

提问by kelvin

I am having trouble when installing Caffe Deep Learning Framework on Python:

在 Python 上安装 Caffe 深度学习框架时遇到问题:

When I run makecommand at caffe directory, it says

当我make在 caffe 目录中运行命令时,它说

hdf5.h:no such directory

hdf5.h:没有这样的目录

The steps I have done:

我做过的步骤:

I will be grateful if someone can help me.

如果有人可以帮助我,我将不胜感激。

Error message:

错误信息:

CXX src/caffe/util/hdf5.cpp
in file include from src/caffe/util/hdf5.cpp:1:0:
./include/caffe/util/hdf5.hpp:6:18: fatal error: hdf5.h: No such file or directory
compilation terminated 

Makefile:572 recipe for target '.build_release/src/caffe/util/hdf5.o'       
failed Make:*** [.build_release/src/caffe/util/hdf5.o] Error 1

回答by alfakini

What is the version of your Ubuntu install? Try this. In your Makefile.configtry to append /usr/include/hdf5/serial/to INCLUDE_DIRS:

你的 Ubuntu 安装版本是什么?尝试这个。在您Makefile.config尝试附加/usr/include/hdf5/serial/INCLUDE_DIRS

--- INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
+++ INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/

and rename hdf5_hland hdf5to hdf5_serial_hland hdf5_serialin the Makefile:

并重新命名hdf5_hl,并hdf5hdf5_serial_hlhdf5_serialMakefile

--- LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5
+++ LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_serial_hl hdf5_serial

More about the bug fix here.

有关错误修复的更多信息,请点击此处

回答by loretoparisi

This solution worked for me on the Ubuntu16.04LTS

这个解决方案对我有用 Ubuntu16.04LTS

sudo apt-get install libhdf5-10
sudo apt-get install libhdf5-serial-dev
sudo apt-get install libhdf5-dev
sudo apt-get install libhdf5-cpp-11
find /usr -iname "*hdf5.h*"
/usr/include/hdf5/serial/hdf5.h
export CPATH="/usr/include/hdf5/serial/"

回答by iparjono

Another case I've experienced with:

我经历过的另一个案例:

I was using Ubuntu 14.04 and installing hdf5-1.10.0.

我正在使用 Ubuntu 14.04 并安装hdf5-1.10.0

I found hdf5.hwas located in /usr/local/hdf5/include. Thus, I modified Makefile.configfile by adding that location to INCLUDE_DIRS.

我发现hdf5.h位于/usr/local/hdf5/include. 因此,我Makefile.config通过将该位置添加到INCLUDE_DIRS.

# Whatever else you find you need goes here.
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include \
                    /usr/local/hdf5/include

I didn't rename anything in Makefile. It worked fine.

我没有重命名Makefile. 它工作得很好。