python库netcdf4安装时和hdf有关的报错

在安装netcdf4是出现和hdf相关的报错,实际上我此前已经通过conda install hdf5安装了hdf库,但安装netcdf时还是找不到hdf5。 最终豆包给出了接近方案是可行的,方法是使用conda 同时安装hdf和netcdf,命令如下:

$conda install -c conda-forge hdf5 netcdf4==1.5.6

具体安装报错的表现:

(python38) [liucouhua_p@paraai-n32-h-01-ccs-master-2 pkgconfig]$ pip install netcdf4==1.5.6 -i https://pypi.tuna.tsinghua
.edu.cn/simple
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting netcdf4==1.5.6
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/79/0d/caa957cc1b42b718ce4b9b3e849e6f7aa99faad2d522d8f2d7a33500fba0/netCDF4-1.5.6.tar.gz (763 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [24 lines of output]
      Package hdf5 was not found in the pkg-config search path.
      Perhaps you should add the directory containing `hdf5.pc'
      to the PKG_CONFIG_PATH environment variable
      Package 'hdf5', required by 'virtual:world', not found
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-h8yxcwoh/netcdf4_35a1603bf73d415886a3a05531df84d8/setup.py", line 441, in <module>
          raise ValueError('did not find netCDF version 4 headers')
      ValueError: did not find netCDF version 4 headers
      reading from setup.cfg...
      checking /home/bingxing2/ailab/liucouhua_p/.conda/envs/python38/include ...
      HDF5 library version: 1.12.1 headers found in /home/bingxing2/ailab/liucouhua_p/.conda/envs/python38/include
      HDF5 library version: 1.12.1 found in /home/bingxing2/ailab/liucouhua_p/.conda/envs/python38
      
      NETCDF4_DIR environment variable not set, checking standard locations..
      checking /home/bingxing2/ailab/liucouhua_p/.conda/envs/python38 ...
      checking /home/bingxing2/ailab/liucouhua_p/.conda/envs/python38/Library ...
      checking /home/bingxing2/ailab/liucouhua_p ...
      checking /usr/local ...
      checking /sw ...
      checking /opt ...
      checking /opt/local ...
      checking /usr ...
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值