python - mac GDAL_LIBRARY_PATH 异常中 Django 的 GDAL 配置
问题描述
我尝试通过 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.
解决方案
我检查了“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"
这个对我有用。
推荐阅读
- unity3d - 从 Blender 导入 Unity 模型时缺少零件
- r - 通过 Y 列的第一个字母显示 X 列的平均值。结果令人困惑
- asp.net - 即使在 asp.net core razor 页面中选中,复选框列表也会返回 false
- python-3.x - 无法从“google.cloud”(未知位置)导入名称“dataproc_v1”
- regex - 如何使用 RewriteBase 将 `localhost` 更改为 `localhost/subdir`?
- java - 有没有办法在 Spring RSocket 中查看 REQUEST_N 交换
- linux - 将 Ubuntu 中不存在的命令映射到现有命令
- c# - 将列表中每一项的值提交给控制器(MVC)
- c++ - 如何将字节从 uint64_t 转换为 double?
- php - 循环不会在返回时停止?