Python: The pysqlite library does not support C extension loading

非 Y 不嫁゛ 提交于 2019-12-10 17:27:02

问题


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

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