Use spatialite extension for SQLite on 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.
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
I have recently faced this problem with mod_spatialite.dll
with Spatialite 5.0.1, Python 3.8 (with Anaconda) and Windows 10. I fixed the problem with the following steps:
- Installed OSGeo4W;
- Copied all the files and folders in
OSGeo4W64\bin
toanaconda3\Library\bin
(without replacing the existing files, as this may break other things in the Python installation). I backed up this folder beforehand so I could undo everything, just in case things go wrong; - Copied
mod_spatialite.dll
(which I had already downloaded) intoanaconda3\Library\bin
.
The reason why I think I had this problem is because of missing recursive dll dependencies; since just getting the direct dependencies (through dumpbin /dependents mod_spatialite.dll
) and copying them to the anaconda3\Library\bin
folder did not solve the problem, so I came to the conclusion that I was missing a dependency of some dependency. Given that all dependencies are already neatly placed in OSGeo4W64\bin
, copying everything from there solved it for me.