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

Why can I access gdal in my python 3.6 shell but not my django shell

我有一个 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,所以我不确定问题出在哪里。会不会是路径问题?

作为,我能够通过运行解决问题:

python3 manage.py shell