我正在尝试让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'
并将mod_spatialite-x.x.x-win-x86.7z中的所有DLL文件解压缩到Python安装目录. dll显然需要与python.exe在同一个文件夹中.另外我想根据你的python安装,mod_spatialite包需要32/64位.如果你遗漏了一些dll,你会得到同样的错误“找不到指定的模块”,不管丢失了什么dll文件,所以它有点误导.
我使用mod_spatialite稳定版本4.3.0a x86和Python 3.5.2 32位.
其他线程在同一个问题上有各种各样的答案: