Skip to content

Instantly share code, notes, and snippets.

@underchemist
Created October 10, 2019 02:13
Show Gist options
  • Save underchemist/bcb4919f7b2fada3ee48aeb9d095d4b0 to your computer and use it in GitHub Desktop.
Save underchemist/bcb4919f7b2fada3ee48aeb9d095d4b0 to your computer and use it in GitHub Desktop.
Compiling GDAL python bindings on windows
rem Assumes visual studio build tools installed
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat
conda activate <env name>
conda install -c conda-forge gdal
rem Uninstalling pre-installed python bindings to show that we can compile ourselves
pip uninstall gdal
rem Set environment variables
set INCLUDE=C:\<conda install location>\envs\<env name>\Library\include;%INCLUDE%
set LIB=C:\<conda install location>\envs\<env name>\Library\lib;%LIB%
pip install gdal
rem alternatively
rem pip install --global-option=build_ext --global-option="-IC:\<conda install location>\envs\<env name>\Library\include" --global-option="-LC:\<conda install location>\envs\<env name>\Library\lib" gdal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment