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-command-line モードで入力した場合
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」を提供します。よろしくお願いします。