无法导入使用apt-get安装的python软件包

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

在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?我不在虚拟环境中。

ubuntu pip apt-get
1个回答
0
投票

[pygrib安装到的Python相同)>

    $ 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.

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