1. 安装HDF5 1.10以及对应的python hdf5的包 (HDF5 1.10.4安装具体可参考其他博客)
2. 使用命令行环境变量安装对应的python hdf5包,HDF5_DIR=/usr/local/hdf5 pip install h5py
系统内安装有其他HDF5版本,比如1.8.16,为了使用新安装的版本所以添加环境变量制定使用的HDF5版本
(参考:https://groups.google.com/forum/#!topic/h5py/j6wolQ1vJgE)
一个HDF5-1.10.1的下载链接:https://download.youkuaiyun.com/download/heartwasd95/10742368
具体步骤如下:
Then you should be fine. Install HDF5 1.10 from source into somewhere you want to. The .tar is here:
https://www.hdfgroup.org/HDF5/release/obtainsrc5110.html
Follow the install readme but basically you just need to give it a directory with:
> ./configure --prefix=/usr/local/hdf5 (这次失误在新机器上安装在了/usr/local/,以后用到时需要注意路径指定在/usr/local/)
before you make and then,
> make -j 32 ## 嘿嘿嘿,boss给买了双cpu的服务器,最多支持32进程 ?
> make check -j 32
> sudo make install -j 32
> sudo make check-install -j 32
Now install with you anaconda version of python. You may want to make a separate environment using conda but that's your call.
Remove the h5py you have with anaconda using
> conda uninstall h5py
or
> pip uninstall h5py
Then use pip to reinstall h5py but pointing to the HDF5 library you made from source. From here: http://docs.h5py.org/en/latest/build.html
> HDF5_DIR=/usr/local/hdf5 pip install h5py (对我的机器而已,指定路径 HDF5_DIR=/usr/local/ pip install hfpy)
Then you should be good. Open up a python terminal and test if you can use SWMR mode:
> import h5py
> f = h5py.File("./swmr.h5", 'a', libver='latest', swmr=True) # SWMR (Single-Writer/Multiple-Reader)