zoukankan      html  css  js  c++  java
  • Linux写配置HDF5的python包h5py

            闲言碎语不讲,直接进入正题。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

  • 相关阅读:
    既然选择了远方,就只顾风雨兼程!
    slots
    面向对象
    模块和作用域
    偏函数
    python中decorator
    返回函数
    filter, sort
    map/reduce
    开发步骤
  • 原文地址:https://www.cnblogs.com/ahnucao/p/4953116.html
Copyright © 2011-2022 走看看