在Debian上升级Python的sqlite3 [英] Upgrade Python's sqlite3 on Debian

查看:248
本文介绍了在Debian上升级Python的sqlite3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Debian的linux2上使用Python 2.7.6(默认值,2014年3月22日,22:59:56)[GCC 4.8.2],并且我通常使用模块sqlite3没有任何问题.

I'm using Python 2.7.6 (default, Mar 22 2014, 22:59:56) [GCC 4.8.2] on linux2 on my Debian, and I'm usually using module sqlite3 without any problem.

编译了Sqlite扩展名 spellfix,加载时出现此错误:

I compiled a Sqlite extension spellfix, I get this error when loading it:

sqlite3.OperationalError:./spellfix.so:未定义符号:sqlite3_malloc64

sqlite3.OperationalError: ./spellfix.so: undefined symbol: sqlite3_malloc64

我认为可能是因为sqlite3模块太旧了:

I think it might be because the sqlite3 module is too old:

import sqlite3
print sqlite3.version          # 2.6.0
print sqlite3.sqlite_version   # 3.8.2

(在另一台sqlite3.sqlite_version为3.8.7.x的计算机上,扩展程序可以很好地加载).

(On another machine where sqlite3.sqlite_version is 3.8.7.x the extension loads fine).

我尝试过:

pip install --upgrade pysqlite

但仍然相同:sqlite3.sqlite_version保持3.8.2.

but it's still the same: sqlite3.sqlite_version stays 3.8.2.

如何升级Python sqlite3模块(标准库中内置)?

推荐答案

您正确地认为sqlite3版本会导致此问题. sqlite_malloc64版本3.8.7 引入的.

You are right in thinking that the version of sqlite3 causes the problem. sqlite_malloc64 was introduced with release 3.8.7.

我建议您编译3.8.2版随附的spellfix.c版本,而不是尝试升级可能最终破坏Python安装的Python sqlite3模块.

Instead of trying to upgrade the Python sqlite3 module which may end up breaking your Python installation, I would suggest compiling the version of spellfix.c included with version 3.8.2.

您可以在此处找到源: https://www.sqlite.org/src/tarball/27392118/SQLite-27392118.tar.gz

You can find the source here: https://www.sqlite.org/src/tarball/27392118/SQLite-27392118.tar.gz

您可以从此处建立合并:

From there you can build the amalgamation with:

sh configure
make sqlite3.c

您将在tsrc文件夹中具有sqlite3.hsqlite3ext.h.然后使用以下命令编译spellfix.c扩展名:

You will have sqlite3.h and sqlite3ext.h in the tsrc folder. Then compile the spellfix.c extension with:

gcc -g -fPIC -shared spellfix.c -I ../../tsrc -o spellfix.dll

并且您应该获得与您的sqlite3版本兼容的spellfix.dll.

And you should get a compatible spellfix.dll that runs with your version of sqlite3.

这篇关于在Debian上升级Python的sqlite3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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