How to use/install rtree in sqlite3 module in python 2.7 on windows

时光总嘲笑我的痴心妄想 提交于 2020-01-06 14:07:28

问题


I'm trying to use spatialite database with my django project that is using contrib.gis application (GeoDjango). When syncing database django gives an error "no such module: rtree". Apparently the sqlite3 module that ships with python 2.7.3 doesn't support rtree in sqlite database.

How this can be fixed?


回答1:


You need to build sqlite with the

SQLITE_ENABLE_RTREE

flag set. How you do that depends on your environment, but typically adding something like:

-DSQLITE_ENABLE_RTREE=1

to your compiler flags will usually be enough.




回答2:


looks like you need to install a spatial backend such as spatiallite see https://pypi.python.org/pypi/pyspatialite



来源:https://stackoverflow.com/questions/20600073/how-to-use-install-rtree-in-sqlite3-module-in-python-2-7-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!