Here are steps to install GDAL in Anaconda with python bindings.
- Download and Install Anaconda (or Miniconda for minimal setup) For Windows a shortcut to anaconda prompt will be created in the start menu which should open command prompt with conda activated. In Linux you will be asked to make conda automatically start whenever bash starts. You can also activate it manually.
- (Optional. You can skip this if you want to only use base) Create a Conda environment with python.
conda create -n geospatial python=3.9
To list environments
conda env list
To activate an environment
conda activate geospatial
- Install GDAL
conda install -c conda-forge gdal
- Test your installation
gdalinfo --version
Should output something like this
GDAL 3.4.1, released 2021/12/27
To test python bindings:
from osgeo import gdal
print(gdal.__version__)