Reputation: 117
I tried to install GDAL in macos by the command for django brew install django
and it successfully installed and I have also used pip install GDAL
command and it also installed successfully.
But, When I tried to run the django server it throw a error set a path for GDAL library.
django.core.exceptions.ImproperlyConfigured: Could not find the GDAL library (tried "gdal", "GDAL", "gdal3.2.0", "gdal3.1.0", "gdal3.0.0", "gdal2.4.0", "gdal2.3.0", "gdal2.2.0", "gdal2.1.0", "gdal2.0.0"). Is GDAL installed? If it is, try setting GDAL_LIBRARY_PATH in your settings.
Upvotes: 2
Views: 2231
Reputation: 57690
Those packages come with package config binaries.
Set these environment in the shell and than run your django specific commands.
export GDAL_LIBRARY_PATH="$(gdal-config --prefix)/lib/libgdal.dylib"
export GEOS_LIBRARY_PATH="$(geos-config --prefix)/lib/libgeos_c.dylib"
Upvotes: 0
Reputation: 21
I checked the 'gdal' and 'goes' library versions,
brew info gdal
brew info geos
And afterward, I put the two lines into my setting.py
GDAL_LIBRARY_PATH = "/opt/homebrew/Cellar/gdal/3.3.2_3/lib/libgdal.dylib"
GEOS_LIBRARY_PATH = "/opt/homebrew/Cellar/geos/3.9.1/lib/libgeos_c.dylib"
It works for me.
Upvotes: 2