在ubuntu(特别是python:3.7.3-stretch基本dockerimage)上,我运行:
$ pip install pandas
$ python -c 'import pandas'
$
那很好。 然后,我尝试通过apt-get pygrib安装软件包python3-grib(不能通过pip安装)。我尝试:
$ apt-get update
$ apt-get install python3-grib
$ python -c 'import pygrib'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'pygrib'
(为简洁起见,省略了安装的输出)。
为什么我不能导入pygrib?我不在虚拟环境中。
答案 0 :(得分:0)
我要做的第一件事是,再次检查您要调用的python与将pygrib
安装到
$ which python
$ python -c "help("modules")"
$ python -c "help("modules pygrip")"
(检查您正在调用的python,以及在那里安装了哪些软件包)。
如果这不起作用,那么ubuntu软件包会有些问题-因此我将尝试从源代码安装;
来自https://github.com/jswhit/pygrib
Clone the github repository, or download a source release from https://pypi.python.org/pypi/pygrib.
Copy setup.cfg.template to setup.cfg, open in text editor, follow instructions in comments for editing. If you are using the old grib_api library instead of the new eccodes library, be sure to uncomment the last line setup.cfg.
Run 'python setup.py build'
Run 'python setup.py install' (with sudo if necessary)
Run 'python test.py' to test your pygrib installation.