我尝试通过django brew install django的命令在macos中安装GDAL,它成功安装了,我也使用了pip install GDAL命令,它也安装成功了。
但是,当我试图运行django服务器时,它抛出了一个错误,为GDAL库设置一个路径。
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.发布于 2021-10-07 23:42:18
我检查了'gdal‘和'goes’库版本,
brew info gdal info geos
然后,我将这两行代码放入我的setting.py
"/opt/homebrew/Cellar/gdal/3.3.2_3/lib/libgdal.dylib“= "/opt/homebrew/Cellar/geos/3.9.1/lib/libgeos_c.dylib”= GDAL_LIBRARY_PATH = GEOS_LIBRARY_PATH
这对我很管用。
https://stackoverflow.com/questions/69387990
复制相似问题