我試圖安裝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