スパゲッティコード

色々やりたいので書いてこうと思います

Pysqlite インストールしようとしてできない時

Review BoardをCentOSに入れようとしています。
その中で、SQLiteを使うためにPysqliteを入れないといけないのですが、はまったのでロギング。

easy_install pysqlite

ReviewBoard公式サイトのインストール手順に従うとこのコマンドですが、以下のメッセージが出てインストールできませんでした。

Searching for pysqlite
Reading http://pypi.python.org/simple/pysqlite/
Reading http://pysqlite.googlecode.com/
Reading http://code.google.com/p/pysqlite/downloads/list
Best match: pysqlite 2.6.3
Downloading https://pysqlite.googlecode.com/files/pysqlite-2.6.3.tar.gz
.....................
src/module.c:296: error: ‘SQLITE_DETACH’ undeclared here (not in a function)
src/module.c: In function ‘init_sqlite’:
src/module.c:426: warning: implicit declaration of function ‘sqlite3_libversion’
src/module.c:426: warning: passing argument 1 of ‘PyString_FromString’ makes pointer from integer without a cast
/usr/include/python2.6/stringobject.h:63: note: expected ‘const char *’ but argument is of type ‘int’
error: Setup script exited with error: command 'gcc' failed with exit status 1

なんかおかしい。
これ、ダウンロードしたファイルのヘッダーがおかしいんだろーか。
うーん。
調べてると自分でダウンロードしてきてインストールしてみろとのこと。

pysql

$ tar xvfz .tar.gz $ cd $ python setup.py build_static install

言われるがままにダウンロードしたURLはこちら。
http://pysqlite.googlecode.com/files/pysqlite-2.6.3.tar.gz
うーん、一緒だなあ…。

そんなわけでとりあえずインストールしてみると…、

できました!

build_static があるところがポイントっぽいですね。