1

我尝试通过 django 的命令在 macOS 中安装 GDAL,brew install django它成功安装,我也使用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.
4

1 回答 1

1

我检查了“gdal”和“goes”库版本,

酿造信息 gdal 酿造信息 geos

之后,我将这两行放入我的 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"

这个对我有用。

于 2021-10-07T23:42:18.440 回答