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
Caffe didn't see hdf5.h when compiling
提问by kelvin
I am having trouble when installing Caffe Deep Learning Framework on Python:
在 Python 上安装 Caffe 深度学习框架时遇到问题:
When I run make
command at caffe directory, it says
当我make
在 caffe 目录中运行命令时,它说
hdf5.h:no such directory
hdf5.h:没有这样的目录
The steps I have done:
我做过的步骤:
Update and upgrade my Ubuntu Server
Install Python 2.7
Having all of the dependencies base on http://caffe.berkeleyvision.org/install_apt.html
Run cp cp Makefile.config.example Makefile.config
Uncomment cpu_only = 1 in Makefile.config
更新和升级我的 Ubuntu 服务器
安装 Python 2.7
运行 cp cp Makefile.config.example Makefile.config
在 Makefile.config 中取消注释 cpu_only = 1
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.config
try 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_hl
and hdf5
to hdf5_serial_hl
and hdf5_serial
in the Makefile
:
并重新命名hdf5_hl
,并hdf5
以hdf5_serial_hl
和hdf5_serial
在Makefile
:
--- 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.h
was located in /usr/local/hdf5/include
. Thus, I modified Makefile.config
file 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
. 它工作得很好。