I recently gave up trying to get the gisinternals versions of GDAL's Python bindings to work, and sought instead to use the 'gohlke' approach - getting the appropriate wheel from the UCI repository.
For me, the 'appropriate' whl was
GDAL-2.0.2-cp27-none-win32.whl, as I am running 32-bit Python 2.7.11.
When I was using the gisinternals version, I had used
gdal-201-1500-core.msi for the core, and
GDAL-2.1.0.win32-py2.7.msi for the Python bindings. My Python is compiled against MCSV1500, as is evident below.
Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec 5 2015, 20:32:19) [MSC v.1500 32 bit (Intel)] on win32
Having installed the gisinternals stuff I did tout ce qu'il faut: i.e.,
- added GDAL_DATA to the environment with value
C:\Program Files (x86)\GDAL\gdal-data(having verified that was the directory)
C:\Program Files (x86)\GDALat the start of the PATH
GDAL and OGR ran perfectly from the command line,
ogrinfo --version gave the right version, and I thought I was off to the races.
Then I tried to run a Python script that tried to
import ogr - fail (same for
from osgeo import ogr.
I checked double-checked, triple-checked and so forth, and eventually gave up and ditched the gisinternals stuff.
I have set the gisinternals Python bindings up before in such a way that they worked against Python 2.7.3 MCSV1500 and GDAL 1.1, and I was looking var by var at the two machines and there was literally no difference in the PATH or GDAL_DATA variables (since Python and GDAL paths on the two machines were the same:
C:\Program Files (x86)\GDAL).
OK - long story even longer, I downloaded the
whl referred to above, and
pip-ed it into place without drama.
Then I fired up Python, typed
import ogr, and everything worked.
Enthused almost beyond the human capacity for joy, I opened a ConEMU window and typed
ogrlinfo --version, and got the dreaded
"OG-what? Never heard of it" message.
I figured that the 'gohlke' package must have put GDAL somewhere other than
C:\Program Files (x86)\GDAL - so off I went to find it and amend that PATH and GDAL_DATA variables as appropriate.
And here's the thing: I don't have any GDAL folder anywhere, it seems.
So - finally - the questionS:
Are those who install the Gohlke GDAL, effectively giving up any hope of being able to use GDAL/OGR at the command line? That seems unlike something that's intended, but I've never seen any reference to command-line use of GDAL installed by the 'gohlke' route.
Second question - in the hope that I've got screen-hypnosis and looked straight past teh Gohlke GDAL folder... does Gohlke's whl install GDAL to a non-standard folder? [UPDATE: Yes. Yes, it does. See self-answer below]