Windows中pycharm下安装cfgrib 您所在的位置:网站首页 安装metpy Windows中pycharm下安装cfgrib

Windows中pycharm下安装cfgrib

2023-07-14 01:13| 来源: 网络整理| 查看: 265

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



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有