gpt4 book ai didi

python - "Unable to locate the SpatiaLite library." Django

转载 作者:太空狗 更新时间:2023-10-30 02:41:18 25 4
gpt4 key购买 nike

我试图让 Django 的 SQLite3 接受空间查询。 This tutorial建议我将其添加到设置中:

SPATIALITE_LIBRARY_PATH = 'mod_spatialite'

产生此错误的原因:

django.core.exceptions.ImproperlyConfigured: Unable to load the SpatiaLite library extension "mod_spatialite" because: The specified module could not be found.

我也试过这样做:

SPATIALITE_LIBRARY_PATH = r'C:\\Program Files (x86)\\Spatialite\\mod_spatialite-4.3.0a-win-x86\\mod_spatialite-4.3.0a-win-x86\\mod_spatialite.dll'

如果我不添加这个变量,我在迁移时会收到这个错误:

django.core.exceptions.ImproperlyConfigured: Unable to locate the SpatiaLite library. Make sure it is in your library path, or set SPATIALITE_LIBRARY_PATH in your settings.

谢谢你..

最佳答案

有趣的是,5 天后我遇到了同样的问题。经过一番摸索后,我开始工作了:

设置

SPATIALITE_LIBRARY_PATH = 'mod_spatialite'

并将所有 DLL 文件从 mod_spatialite-x.x.x-win-x86.7z 提取到您的 Python 安装目录。 dll 显然需要与 python.exe 位于同一文件夹中。另外我想 mod_spatialite 包需要 32/64 位根据你的 python 安装。如果您缺少某些 dll,无论缺少什么 dll 文件,您都会收到相同的错误“找不到指定的模块”,所以这有点误导。

http://www.gaia-gis.it/gaia-sins/下载

我使用 mod_spatialite 稳定版 4.3.0a x86 和 Python 3.5.2 32 位。

关于同一问题的其他线程有各种答案:

关于python - "Unable to locate the SpatiaLite library." Django ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39787700/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com