您的位置:首页 > 运维架构 > Linux

Linux写配置HDF5的python包h5py

2015-11-10 15:08 525 查看
闲言碎语不讲,直接进入正题。Python在科学计算的应用越来越丰度,而hdf(5)数据的应用也非常广泛。python提供了h5py包供开发者处理数据(http://www.h5py.org/)。在windows下配置h5py,可以通过安装Anaconda以及pythonxy来做相对方便,现在主要说在linux下该环境的配置。

(1)使用: sudo apt-get install python-pip安装pip工具,然后使用pip install numpy和pip install numpy安装基本环境。

(2)使用: sudo apt-get install libhdf5-dev安装hdf的开发库(重要)。否则会报出:

#include “hdf5.h”

compilation terminated.

error: command ‘gcc’ failed with exit status:1

(3)安装HDF5:按照官方文档的说明就可以(ftp://ftp.hdfgroup.org/HDF5/current/src/unpacked/release_docs/INSTALL)。

$tar zxf hdf5-X.Y.Z.tar.gz$ cd hdf5-X.Y.Z
$ ./configure --prefix=/your/install/dir <more configure_flags>
$ sudo make
$ sudo make check                # run test suite.
$ sudo make install
$ sudo make check-install        # verify installation.

这里也有一个安装教程,是我后来发现的:(http://www.aichengxu.com/view/24309)

(4)使用:sudo pip install h5py安装h5py库,当你看到Successfully install h5py. Cleaning up…就大功告成了。

(5)测试一下:

import h5py as h5

h5.run_tests()

成功运行。

具体使用可以参照帮助文档(http://docs.h5py.org/en/latest/build.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: