“无法找到SpatiaLite库”。 Django的 [英] "Unable to locate the SpatiaLite library." Django

查看:402
本文介绍了“无法找到SpatiaLite库”。 Django的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

  SPATIALITE_LIBRARY_PATH ='mod_spatialite'

其中产生此错误:


django.core.exceptions.ImproperlyConfigured:无法加载
SpatiaLite库扩展名mod_spatialite,因为:指定的
模块无法找到。


我也试过这样做:

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

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


django.core.exceptions .ImproperlyConfigured:无法找到
SpatiaLite库。确保它在您的库路径中,或在您的设置中设置
SPATIALITE_LIBRARY_PATH。


谢谢..

解决方案

有趣的是,5天后,我遇到了同样的问题。经过一点点戳,我得到它的工作:



设置

  SPATIALITE_LIBRARY_PATH ='mod_spatialite'

并从mod_spatialite-xxx-win- x86.7z到你的Python安装目录。 dll显然需要与python.exe在同一个文件夹中。另外我想象根据你的python安装,mod_spatialite包需要32/64位。如果你缺少一些dll,你会得到相同的错误指定的模块未找到,无论什么dll文件丢失,所以这有点误导。



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



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



其他线程与各种答案相同的问题:




I'm trying to make Django's SQLite3 accept spatial queries. This tutorial suggests that I add this to settings:

SPATIALITE_LIBRARY_PATH = 'mod_spatialite'

Which produces this error:

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

I also tried doing this :

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'

If I don't add this variable I receive this error when I migrate:

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.

Thank you..

解决方案

Amusingly enough 5 days later I'm having the same issue. After a little bit of poking around I got it working:

Set

SPATIALITE_LIBRARY_PATH = 'mod_spatialite'

and extract ALL the DLL files from the mod_spatialite-x.x.x-win-x86.7z to your Python installation directory. The dll's apparently need to be in the same folder with python.exe. Also I imagine the mod_spatialite package needs to 32/64 bit according to your python installation. If you're missing some dll's, you get the same error "specified module not found" regardless of what dll file is missing, so it's a bit misleading.

Downloaded from http://www.gaia-gis.it/gaia-sins/

I used mod_spatialite stable version 4.3.0a x86 with Python 3.5.2 32-bit.

Other threads on the same issue with all sorts of answers:

这篇关于“无法找到SpatiaLite库”。 Django的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆