为什么我可以在我的python 3.6 shell中访问gdal而不是我的django shell

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

我有一个django项目,我想使用gdal。我已经安装了所有依赖项,如果我这样做,它可以正常工作:

$ python3.6
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from osgeo import gdal
>>> gdal
<module 'osgeo.gdal' from '/usr/lib/python3/dist-packages/osgeo/gdal.py'>

但是当我这样做时:

$python manage.py shell
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from osgeo import gdal
Traceback (most recent call last):
  File "<console>", line 1, in <module>
ModuleNotFoundError: No module named 'osgeo'

它似乎都使用相同的python,所以我不知道问题是什么。这可能是路径问题吗?

python django python-3.x gdal geodjango
1个回答
0
投票

作为Jonah Bishop suggested,我能够通过运行来解决问题:

python3 manage.py shell
© www.soinside.com 2019 - 2024. All rights reserved.