问题
I'm trying to get Spatialite to work with my django app, however, I've hit the following wall:
raise ImproperlyConfigured('The pysqlite library does not support C extension loading. '
django.core.exceptions.ImproperlyConfigured: The pysqlite library does not support C extension loading. Both SQLite and pysqlite must be configured to allow the loading of extensions to use SpatiaLite.
make: *** [syncdb] Error 1
Using ubuntu 12.04, I have installed pysqlite using pip
within the same user and with sudo. I have also tried compiling pysqlite and enabled extension loading myself.
Help?
回答1:
The default for pysqlite is to build without extension loading support. So just rebuilding won't help. You need to change a setting (in setup.cfg).
So I'd suggest downloading as a tarball, and looking in setup.cfg:
[build_ext]
#define=
#include_dirs=/usr/local/include
#library_dirs=/usr/local/lib
libraries=sqlite3
define=SQLITE_OMIT_LOAD_EXTENSION
That last line is the problem. The easiest way is just to comment it out (add a # at the start of the line), so it looks like:
[build_ext]
#define=
#include_dirs=/usr/local/include
#library_dirs=/usr/local/lib
libraries=sqlite3
# define=SQLITE_OMIT_LOAD_EXTENSION
Then rebuild according to the instructions in the tarball (see doc/install-source.txt)
来源:https://stackoverflow.com/questions/11093593/python-the-pysqlite-library-does-not-support-c-extension-loading