[GIS] I cannot find osr after installing OSGeo4W package

gdalosgeoosgeo4w

I wanted to be able to import OSR from GDAL on my Python 2.7 (Anaconda) Windows 7 64-bit. I installed OSGeo4W after reading this post and eventually I'd like to import osr

from osgeo import osr

However, I cannot find any osgeo or osr after installing osgeo.

The other option would be installing GDAL from here but it says that "Do not use together with OSGeo4W".

How can I import osr after installing OSGeo4W?

I downloaded 64 bit version under Quick Start for OSGeo4W Users from https://trac.osgeo.org/osgeo4w/wiki not from https://trac.osgeo.org/gdal/wiki/GdalOgrInPython. Perhaps that is causing the problem.

Best Answer

Because OSGeo4W installs its own local Python site, there are certain environment variables that must be set to use it. The simplest way to do this is by running the "OSGeo4W Shell" and then running python from the resulting command line. Alternatively, you can inspect the "OSGeo4W.bat" batch file in the root of your OSGeo install folder for ideas about how to roll your own script.