Python:pysqlite库不支持C扩展加载 [英] Python: The pysqlite library does not support C extension loading

查看:117
本文介绍了Python:pysqlite库不支持C扩展加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试让Spatialite与我的django应用程序一起使用,但是,我遇到了以下难题:

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

使用ubuntu 12.04,我已经在同一用户中使用sudo在pip中安装了pysqlite.我还尝试了编译pysqlite并启用了扩展程序自己加载.

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.

帮助?

推荐答案

pysqlite的默认设置是在不支持扩展加载的情况下进行构建.因此,仅重建将无济于事.您需要更改设置(在setup.cfg中).

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).

所以我建议下载为tarball,并查看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

然后根据压缩包中的说明进行重建(请参阅doc/install-source.txt)

Then rebuild according to the instructions in the tarball (see doc/install-source.txt)

这篇关于Python:pysqlite库不支持C扩展加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆