安装Keras时发生Linux错误

2024-10-01 09:27:19 发布

您现在位置:Python中文网/ 问答频道 /正文

在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存储库,并使用以下命令安装它:

^{pr2}$

我的Linux规范是:

  • 分发服务器ID:Ubuntu
  • 说明:Ubuntu 14.04.2 LTS
  • 发布日期:14.04
  • 代号:信任

Tags: installfromcorenumpyapiincludelibpackages
2条回答

真正的错误是:

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

此错误表示头文件hdf5.h丢失。

运行以下命令安装头文件:

sudo apt-get install libhdf5-dev

请注意,要安装h5py包,请运行以下命令:

^{pr2}$

希望这能解决你的问题

您需要安装hdf5包以获取所需的头。在

相关问题 更多 >