在python中安装pysqlite,使用sqlite 3版本和自定义文件头

2024-04-27 16:08:33 发布

您现在位置:Python中文网/ 问答频道 /正文

我想用自定义文件头编译sqlite 我按照这里给出的步骤http://trac.edgewall.org/wiki/PySqlite

Download pysqlite 
Extract it 
export  CFLAGS="-DSQLITE_FILE_HEADER=\\\"vivek\\\"" 
Run  python   setup.py build_static 
python   setup.py install  -f

但当运行python并检查sqlite版本时

^{pr2}$

它正在提供旧版本的sqlite。我想应该是3。 我试着打开数据库,但遇到了错误

 sqlite3.DatabaseError: file is encrypted or is not a database


Python Version

python --version
Python 2.7.3

Tags: 文件pyorghttpsqliteisdownloadwiki
1条回答
网友
1楼 · 发布于 2024-04-27 16:08:33

从Trac站点上的PySqlite页面顶部:

If you're using Python 2.5 and up, you already have a working version of pysqlite 2, bundled as sqlite3. You can stop here ;-)

您使用的是Python2.7,因此需要安装自定义版本。pysqlite已经与python版本绑定在一起了。在

pysqlite是使sqlite可用于python的“粘合剂”。系统sqlite本身需要升级,而不是glue库。在

How can I upgrade the sqlite3 package in Python 2.6?

相关问题 更多 >