错误:找不到模块或包:esmf(缺少 __init__.py?)

问题描述 投票:0回答:1

我按照说明安装了 xesmf (https://xesmf.readthedocs.io/en/latest/installation.html)。

conda create -n xesmf_env
conda activate xesmf_env
conda install -c conda-forge xesmf

conda install -c conda-forge dask netCDF4

conda install -c conda-forge matplotlib cartopy jupyterlab

所有库均已成功安装。但是,当我测试它时,它显示错误:

pip install pytest
pytest -v --pyargs xesmf

错误 - ModuleNotFoundError:没有名为“ESMF”的模块

所以我只测试了 esmf lib,它显示了这个错误:

pytest -v --pyargs esmf

错误:找不到模块或包:esmf(缺少 init.py?)

我该如何解决这个问题?

python installation virtualenv init lib
1个回答
0
投票

我认为这可能与https://github.com/conda-forge/esmf-feedstock/issues/91中提出的问题有关。

此处所讨论的修复涉及在运行 python 之前显式设置 ESMFMKFILE 的路径:

export ESMFMKFILE=/path/to/anaconda3/envs/[envname]/lib/esmf.mk

我也很欣赏@masawdah 的建议,来自同一个线程,用于纯粹的Python修复。

© www.soinside.com 2019 - 2024. All rights reserved.