我正在尝试使用pip安装cfgrib,方法如下:
pip3 install --user eccodes
这将沿着以下路径安装eccodes包:
/Library/name/Python/3.8/lib/python/site-packages
当我尝试运行我的python脚本(见下文(时,我收到一条错误消息,告诉我:
UserWarning: Failed to load cfgrib - most likely there is a problem accessing the ecCodes library. Try `import cfgrib` to get the full error message
import numpy as np
import xarray as xr
import matplotlib.pyplot as plt
import cfgrib
path = '/Users/name/Library/Python/3.8/bin'
fname = 'download.grib'
ds = xr.open_dataset(path+fname,engine = 'cfgrib',backend_kwargs={'indexpath':''})
有人知道怎么解决这个问题吗?
尝试
pip install ecmwflib
它对我有效。
参考
- pip安装eccode时找不到ecCodes库:https://github.com/ecmwf/eccodes-python/issues/54