ValueError: 在 xarray 的 IO 后端中发现以下与输入文件匹配的内容:['netcdf4', 'h5netcdf']

2024-02-21

所以我尝试在 Spyder (Python 3.9) 中运行这个脚本

dset = xr.open_dataset(filename, decode_times=True, use_cftime=True)
print(dset)

但我不断收到此错误:

ValueError: found the following matches with the input file in xarray's IO backends: ['netcdf4', 'h5netcdf']. But their dependencies may not be installed, see:
https://docs.xarray.dev/en/stable/user-guide/io.html 
https://docs.xarray.dev/en/stable/getting-started-guide/installing.html

我已经通过 conda 安装了 ['netcdf4', 'h5netcdf']。

有人遇到过同样的问题吗?我也尝试过这个:

conda install -c anaconda netcdf4 h5netcdf scipy pydap zarr fsspec cftime rasterio cfgrib pooch

但会出现相同的值错误。


根据您的错误消息,您似乎缺少 netcdf4 和 h5netcdf 依赖项。

我建议安装使用conda install在您的终端/命令行或 IDE(如果支持)中(例如 Jupyter 笔记本单元):conda install netcdf4 h5netcdf

如果您使用的 Python 环境不是基本环境,请确保您通过在终端中导航(例如 conda activate MYENV)或在 IDE 中切换到该环境内核来安装到项目所使用的环境。

如果您使用 Jupyter,通常需要重新启动内核才能使更改生效。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

ValueError: 在 xarray 的 IO 后端中发现以下与输入文件匹配的内容:['netcdf4', 'h5netcdf'] 的相关文章

随机推荐