【发布时间】:2015-07-11 04:50:18
【问题描述】:
在 Ubuntu 服务器上安装 Keras 时,我遇到了这个奇怪的错误:
Cythonizing /tmp/easy_install-qQggXs/h5py-2.5.0/h5py/utils.pyx
In file included from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1804:0,
from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/ndarrayobject.h:17,
from /usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/arrayobject.h:4,
from /tmp/easy_install-qQggXs/h5py-2.5.0/h5py/api_compat.h:26,
from /tmp/easy_install-qQggXs/h5py-2.5.0/h5py/defs.c:287:
/usr/local/lib/python2.7/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:15:2: warning: #warning "Using deprecated NumPy API, disable it by " "#defining NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
#warning "Using deprecated NumPy API, disable it by " \
^
In file included from /tmp/easy_install-qQggXs/h5py-2.5.0/h5py/defs.c:287:0:
/tmp/easy_install-qQggXs/h5py-2.5.0/h5py/api_compat.h:27:18: fatal error: hdf5.h: No such file or directory
#include "hdf5.h"
^
compilation terminated.
error: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
任何想法如何解决这个问题?
我从https://github.com/fchollet/keras 下载了 Keras 存储库,并使用此命令进行安装:
sudo python setup.py install
我的 Linux 规格是:
- 分销商 ID: Ubuntu
- 描述: Ubuntu 14.04.2 LTS
- 发布: 14.04
- 代号:值得信赖的
【问题讨论】:
-
问题似乎很明显,它需要一个名为
hdf5.h的文件在您的包含路径上,而您没有。大概您忘记安装其中一个先决条件(或者 repo 的作者忘记记录它),很可能是名称中带有“hdf5”的库。 (另请注意,在许多 linux 发行版中,库被分成两个包,例如hdf5和hdf5-dev,因此如果您从供应商存储库安装,您将需要后者,而不仅仅是前者,以获取开发文件。 ) -
太棒了,我缺少的是 libhdf5-dev。我已经安装了 Keras,谢谢你们。
-
供将来参考:使用“code”按钮,而不是“code sn-p”按钮,包括 Python 代码、shell 脚本代码和输出等内容; code sn-ps 仅适用于您希望在页面上运行的 JavaScript 代码。
-
会做,明白,再次感谢。
标签: python ubuntu-14.04 keras