对于python,安装hdf5 / netcdf4

con*_*sed 6 python install hdf5

在Linux Mint 17.1上执行此操作。

当我尝试:

pip install hdf5

我得到错误

"Could not find a version that satisfies the requirement hdf5 (from versions: ) No matching distribution found for hdf5"

从长远来看,我正在尝试安装netcdf4,但是直到安装hdf5后才能这样做。大概从上周我尝试使用netcdf4做起,我应该使用pip install netcdf4,err hdf5 ...至少在hdf5的情况下。

如果尝试,pip install h5py我会收到以下消息:

Requirement already satisfied (use --upgrade to upgrade): h5py in ./anaconda3/lib/python3.5/site-packages Requirement already satisfied (use --upgrade to upgrade): numpy>=1.6.1 in ./anaconda3/lib/python3.5/site-packages (from h5py) Requirement already satisfied (use --upgrade to upgrade): six in ./anaconda3/lib/python3.5/site-packages (from h5py)

但是,如果我继续尝试,pip install netcdf4它就会说:

Collecting netcdf4 Using cached netCDF4-1.2.3.1.tar.gz Complete output from command python setup.py egg_info: Package hdf5 was not found in the pkg-config search path. Perhaps you should add the directory containinghdf5.pc'到PKG_CONFIG_PATH环境变量中没有找到软件包'hdf5',找到cython版本0.23.4 ...从setup.cfg中读取...

HDF5_DIR environment variable not set, checking some standard locations ..
checking /home/meant2b ...
checking /usr/local ...
checking /sw ...
checking /opt ...
checking /opt/local ...
checking /usr ...
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-build-pq3yt4ek/netcdf4/setup.py", line 286, in <module>
    raise ValueError('did not find HDF5 headers')
ValueError: did not find HDF5 headers

----------------------------------------
Run Code Online (Sandbox Code Playgroud)

/ tmp / pip-build-pq3yt4ek / netcdf4 /中的命令“ python setup.py egg_info”失败,错误代码为1

当我搜索文件时,找不到hdf5.pc文件。

h5py和hdf5之间有区别吗?我是否必须从单个文件编译并安装hdf5,还是可以点安装。

我必须怎么做才能同时安装hdf5和netcdf4?

tun*_*ned 5

您需要为您的 Linux 发行版安装 HDF5 库。在 Ubuntu 中是:

sudo apt-get install libhdf5-serial-dev netcdf-bin libnetcdf-dev

请参阅此链接