首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >对于python,安装hdf5/netcdf4

对于python,安装hdf5/netcdf4
EN

Stack Overflow用户
提问于 2016-03-23 04:21:20
回答 3查看 12K关注 0票数 8

在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...at,至少在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环境变量No package 'hdf5’found cython 0.23.4 found ...正在从setup.cfg读取...

代码语言:javascript
复制
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

----------------------------------------

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

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

h5py和hdf5有什么区别吗?我是否必须从单独的文件编译和安装hdf5,或者我可以通过pip安装。

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

EN

回答 3

Stack Overflow用户

发布于 2016-03-23 05:05:32

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

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

参见this link

票数 6
EN

Stack Overflow用户

发布于 2016-04-15 21:04:59

我在Debian8中也遇到过同样的问题。为了解决这个问题,我以根用户的身份安装库,然后将串行头链接到hdf5库中的一个包含目录,导出HDF_DIR路径并安装netCDF4:

代码语言:javascript
复制
# apt-get install -y libhdf5-dev libnetcdf-dev
# ln -s /usr/include/hdf5/serial /usr/include/hdf5/include
# export HDF5_DIR=/usr/include/hdf5
# pip install netCDF4
票数 1
EN

Stack Overflow用户

发布于 2020-11-03 07:05:04

我在macOS Catalina下也遇到了同样的错误。Had必须安装来自Homebrew的hdf5netcdf4包:

代码语言:javascript
复制
brew install hdf5 netcdf4

之后,pip3 install netcdf4运行得很好。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36164410

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档