Cannot import GDAL
tjreedy at udel.edu
Wed Jan 11 21:06:15 EST 2017
On 1/11/2017 12:31 PM, Falter, Donald [USA] wrote:
> I am new to Python and I am trying to utilize GDAL. I installed Python 3.6. The version I get when I activate IDLE is: MSC v.1900 32 bit (Intel)] on win32. In downloading the GDAL bindings the latest version I can find is release-1800-gdal-2-1-2-mapserver-7-0-2 so I installed the following: gdal-201-1800-core.msi and GDAL-2.1.2.win32-py3.4.msi.
> I added C:\Program Files\GDAL to my path and added the system variables GDAL_DATA = C:\Program Files\GDAL\gdal-data and\
> GDAL_DRIVER_PATH = C:\Program Files\GDAL\gdalplugins
> When I open IDLE and type the following: from osgeo import gdal I get the following error
IDLE does not normally cause imports to fail (though it often get
blamed), but one can check by running, in this case, 3.6, from the
Windows console (ie, Command Prompt) and trying the same import statement.
>>>> from osgeo import gdal
> Traceback (most recent call last):
> File "<pyshell#0>", line 1, in <module>
> from osgeo import gdal
> ModuleNotFoundError: No module named 'osgeo'
Does C:\Program Files\GDAL contain a package 'osgeo' containing a module
I am not sure if the version mismatch pointed out by others would cause
that particular error. If replacing the 3.4 package with a 3.6 package
fixes your problem completely, please let us know.
Terry Jan Reedy
More information about the Python-list