问题描述
我知道以前有人以类似的方式问过这个问题.但是,我在此发现的所有问题都与一些非常具体的系统设置有关,这些设置不适用于我(因为我的也是).
I know that this has been asked in some similar ways before. However, all questions I found on this dealt with some very specific system setups which were not applicable for me (because so is mine).
系统:
- Windows 7 64位
- Python 3.4 64位
- sqlite3 2.6.0(我猜是随Python一起提供的)
- Spatialite Windows二进制文件2.3.1(还有其他重要的事情吗?)
- Windows 7 64bit
- Python 3.4 64bit
- sqlite3 2.6.0 (shipped with Python I guess)
- Spatialite Windows binaries 2.3.1(anything else of importance?)
如何激活sqlite3模块的spatialite
扩展名?
How can I activate the spatialite
extension for the ´sqlite3´ module?
我尝试过的方式(其他处于类似问题中的人说的有效方式):
What I tried (the way that other people in similar questions say it works):
- 从 https://www.gaia-gis.it/下载spacespace-2.3.1/binaries.html :
- libspatialite-win-x86-2.3.1.zip
- proj-win-x86-4.6.1.zip
- geos-win-x86-3.1.1.zip
- libiconv-win-x86-1.9.2.zip
- Downloading from https://www.gaia-gis.it/spatialite-2.3.1/binaries.html :
- libspatialite-win-x86-2.3.1.zip
- proj-win-x86-4.6.1.zip
- geos-win-x86-3.1.1.zip
- libiconv-win-x86-1.9.2.zip
然后运行
import sqlite3 conn = sqlite3.connect(":memory:") conn.enable_load_extension(True) conn.execute('SELECT load_extension("libspatialite-2.dll")')
给予
conn.execute("SELECT load_extension('libspatialite-2.dll')") sqlite3.OperationalError: The specified module could not be found.
我还能尝试做些什么?
推荐答案
您可能没有将libspatialite-2.dll放置在PATH中的文件夹.也许您可以从Python脚本中添加文件夹(我不知道任何Python).否则,您可以从Windows属性界面中添加它.
you probably don't have the folder in which libspatialite-2.dll is placed in your PATH.Perhaps you can add the folder from within your Python script (I don't know any Python).Or else you could add it from the Windows properties interface.
顺便说一句,您正在使用的是Spaceite的非常旧的版本:请在此处查看较新的版本: https://www.gaia-gis.it/fossil/libspatialite/index
BTW you are using a very old version of spatialite: have a look here for newer versions:https://www.gaia-gis.it/fossil/libspatialite/index
这篇关于在Windows上对SQLite使用spacespaceite扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!