简体   繁体   English

Python 未找到 netCDF4 导入

[英]netCDF4 import not being found by Python

I need to use the netCDF4 module in order to do some processing.我需要使用 netCDF4 模块来进行一些处理。 I have followed the steps on this guide and also tried used anaconda2 as recomended on this post .我按照这个台阶上引导和也尝试使用anaconda2这种方法作为recomended 职位

netCDF4 seems to be installed, as i can run nc-config --version and obtain: netCDF4 似乎已安装,因为我可以运行nc-config --version并获得:

netCDF 4.4.0-rc2

Although, when i try to import netCDF4 in python with:虽然,当我尝试在 python 中导入 netCDF4 时:

from netCDF4 import Dataset

It Returns:它返回:

Traceback (most recent call last):
  File "test.py", line 2, in <module>
    from netCDF4 import Dataset
ImportError: No module named netCDF4

I have all dependencies installed.我已经安装了所有依赖项。 Cython, numpy and h5py. Cython、numpy 和 h5py。
It was working last night, before i turned off the PC.在我关闭电脑之前,它昨晚还在工作。 When i came back this morning, it just would not work.当我今天早上回来时,它就是行不通。 So if i have netCDF4 installed and can check it's version, how come python is not recognizing it as a module?所以如果我安装了 netCDF4 并且可以检查它的版本,python 怎么不把它识别为一个模块?

转换为项目解释器python 2.7,然后运行安装命令;

pip install netCDF4

I used我用过

conda install netcdf4 conda 安装 netcdf4

and it works for python 2.7.它适用于python 2.7。

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

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