我试图安装pysqlite。一些可疑的事情在安装过程中开始出现。为什么我输入:为什么pysqlite无法正常工作?
python setup.py build
我到底以下消息:
src/module.c:286: error: ‘SQLITE_PRAGMA’ undeclared here (not in a function)
src/module.c:287: error: ‘SQLITE_READ’ undeclared here (not in a function)
src/module.c:288: error: ‘SQLITE_SELECT’ undeclared here (not in a function)
src/module.c:289: error: ‘SQLITE_TRANSACTION’ undeclared here (not in a function)
src/module.c:290: error: ‘SQLITE_UPDATE’ undeclared here (not in a function)
src/module.c:291: error: ‘SQLITE_ATTACH’ undeclared here (not in a function)
src/module.c:292: error: ‘SQLITE_DETACH’ undeclared here (not in a function)
src/module.c: In function ‘init_sqlite’:
src/module.c:419: warning: implicit declaration of function ‘sqlite3_libversion’
src/module.c:419: warning: passing argument 1 of ‘PyString_FromString’ makes pointer from integer without a cast
error: command 'gcc' failed with exit status 1
我恰恰忽略了最后一行,并决定继续。所以,我输入:
python setup.py install
而不是,我再次得到了类似的错误消息:
src/module.c:288: error: ‘SQLITE_SELECT’ undeclared here (not in a function)
src/module.c:289: error: ‘SQLITE_TRANSACTION’ undeclared here (not in a function)
src/module.c:290: error: ‘SQLITE_UPDATE’ undeclared here (not in a function)
src/module.c:291: error: ‘SQLITE_ATTACH’ undeclared here (not in a function)
src/module.c:292: error: ‘SQLITE_DETACH’ undeclared here (not in a function)
src/module.c: In function ‘init_sqlite’:
src/module.c:419: warning: implicit declaration of function ‘sqlite3_libversion’
src/module.c:419: warning: passing argument 1 of ‘PyString_FromString’ makes pointer from integer without a cast
error: command 'gcc' failed with exit status 1
之后,我想尝试,如果pysqlite作品。 如果在Python的命令行模式I型
from pysqlite2 import *
Python没有抱怨。但是,如果我尝试按照
的一个实例在我的书:
from pysqlite2 import dbapi2 as sqlite
我得到一个错误信息:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pysqlite2/dbapi2.py", line 27, in <module>
from pysqlite2._sqlite import *
ImportError: No module named _sqlite
没有任何人有任何想法,为什么会发生这个问题如何解决。顺便说一下,我已经安装了一个新版本的Python。 “python -V”给了我“Python 2.6.2”。预先感谢您的任何帮助。
您知道SQLite支持位于标准库中吗?至少从蟒蛇版本2.5 – codeape