Windows中pycharm下安装cfgrib

Windows中pycharm下安装cfgrib

因工作需要需要用到cfgrib,来实现.grib2>>.nc格式文件的转换,现将安装步骤记录与遇到的各种坑记录在下面:

安装步骤

推荐使用Conda可以将依赖包自动安装

(1)依赖包安装:

#Binary dependencies
$ conda install -c conda-forge eccodes

(2)cfgrib安装:

#cfgrib Installation
$ conda install -c conda-forge cfgrib

(3)安装测试

#You may run a simple selfcheck command to ensure that your system is set up correctly:
$ python -m cfgrib selfcheck
Found: ecCodes v2.12.0.
Your system is ready.

备注:具体安装详见https://pypi.org/project/cfgrib/

遇到的坑

(1)conda报错:

$ Solving environment: failed with initial frozen solve. Retrying with flexible solve

我遇到的情况是conda版本过低,解决办法参考如下链接:
[1]: https://blog.csdn.net/LiiXuanYue/article/details/108808260?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.control&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-2.control
(2) 请勿用pip安装,否则会因缺少依赖包,在验证时报以下错误:

$......AttributeError: module 'pyeccodes.compat' has no attribute 'codes_grib_multi_support_off

(3)运行报错(类似于下面,未截图):

ECCODES ERROR   :  Unable to find boot.def. Context path=C:/bld/eccodes_1555087073004/_h_env/Library/share/eccodes/definitions

Possible causes:
- The software is not correctly installed
- The environment variable ECCODES_DEFINITION_PATH is defined but incorrect

ecCodes assertion failed: `0' in C:\bld\eccodes_1555087073004\work\src\grib_context.c:205

在Windows中添加ECCODES_DEFINITION_PATH的环境变量,值为eccodes\definitions在安装目录的路径,我的为:C:\anaconda3\pkgs\eccodes-2.20.0-h5733774_0\Library\share\eccodes\definitions。修改完后重启pycharm

  • 0
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值