繁体   English   中英

通过 pip 在 WSL2 上未正确安装 Cfgrib

[英]Cfgrib is not installed correctly on WSL2 through pip

我正在尝试将cfgrib安装到我的 WSL2 Ubuntu 但是当我输入python3 -m cfgrib selfcheck时,它会给出以下错误,如下所示。

Traceback (most recent call last):
  File "/home/berke/.local/lib/python3.8/site-packages/cfgrib/messages.py", line 42, in <module>
    import pyeccodes.compat as eccodes
ModuleNotFoundError: No module named 'pyeccodes'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.8/runpy.py", line 184, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/lib/python3.8/runpy.py", line 143, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/usr/lib/python3.8/runpy.py", line 110, in _get_module_details
    __import__(pkg_name)
  File "/home/berke/.local/lib/python3.8/site-packages/cfgrib/__init__.py", line 19, in <module>
    from .cfmessage import CfMessage
  File "/home/berke/.local/lib/python3.8/site-packages/cfgrib/cfmessage.py", line 29, in <module>
    from . import messages
  File "/home/berke/.local/lib/python3.8/site-packages/cfgrib/messages.py", line 44, in <module>
    raise exc
  File "/home/berke/.local/lib/python3.8/site-packages/cfgrib/messages.py", line 37, in <module>
    from . import bindings as eccodes
  File "/home/berke/.local/lib/python3.8/site-packages/cfgrib/bindings.py", line 57, in <module>
    raise RuntimeError(f"ecCodes library not found using {LIBNAMES}")
RuntimeError: ecCodes library not found using ['eccodes', 'libeccodes.so', 'libeccodes']

我的 python 版本是Python 3.8.2 是否可以通过pip

PyPI 最新发布的cfgrib版本 0.9.8.5 没有将eccodespyeccodes声明为依赖项,甚至没有声明为额外的。 您可以单独安装其中之一:

pip install eccodes

或者

pip install pyeccodes

(我不知道有什么区别; cfgrib可以同时使用)。

该错误已在存储库中修复,但尚未发布到 PyPI,因此您可以尝试使用git安装最新版本:

pip install --upgrade "git+https://github.com/ecmwf/cfgrib.git#egg=cfgrib"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM