I have a django project that I want to use gdal in. I have installed all the dependencies and it works fine if I do:
$ 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'>
but when I do:
$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'
It appears both are using the same python so I am not sure what the problem is. Could it be a path problem?
As Jonah Bishop suggested, I was able to solve the problem by running:
python3 manage.py shell