1

I'm using IDLE. GDAL command works in QGIS' Python console but not Python 2.7 (ArcMap) and 3.8 (separate install) IDLEs.

So far, I have tried

  1. Downloading this (GDAL/OGR IN PYTHON) and following the instructions in the README text file. Did not work.
  2. Looked at the GDAL releases here (Stable Releases) but there is no GDAL release for Python 3.8.1 MSCv 1916. I followed this article (Installing GDAL for Windows) for this step.
  3. Installed GDAL through the OSGEO4W installer but when I ran a code with this line, it did not work for Python 2.7 and 3.8 (but worked in QGIS python console)

from osgeo import ogr

3
  • I'm reading the Geoprocessing with Python book and I just used QGIS' Python console to run the code so GDAL would work. But it would be helpful if someone can help how to install GDAL on Python 3.8 IDLE. – BallpenMan Feb 17 '20 at 0:58
  • 3
    The most likely problem on Windows is that your system environment variable PATH does not include a reference to your GDAL install folder. The GISInternals python bindings require the core components to be installed in the correct bitedness (32 or 64) as your python install or python and GDAL can't 'talk' to each other. QGIS sets its own PATH on launch, you can see it if you print(os.environ.get('PATH')) in your python console, which should give you some idea about what needs to change in your path. Warning: multiple GDAL installs can exist, blindly changing the path could break something else – Michael Stimson Feb 17 '20 at 1:08
  • Look into using virtual environments to avoid some of these issues – Ian Turton Feb 17 '20 at 8:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.