tags:

views:

499

answers:

1

I am trying to build python2.6 with support for the sqlite3 module.

I have successfully built and installed the sqlite-amalgamation to a non standard path: ./configure --prefix=/my/non/standard/install/path/sqlite/3.6.20/ make make install

I would like the python2.6 build to use this path & build the sqlite3 module. I checked './configure --help' but did not see any type of "--with-sqlite-dir=path" option.

How can I let python's configure know where sqlite lives?

A: 

Rather than rebuilding python, the simplest way to get the most recent sqlite3 is to install the pysqlite package which is the more up-to-date version of the standard library's sqlite3 module. It includes support for more recent sqlite3 features and is upwards compatible. More details are here.

Ned Deily
Hi Ned, thanks for your suggestion I downloaded pysqlite-2.5.5 and used "python setup.py build_static" followed by "python setup.py install" and in my script I am able to use "from pysqlite2 import dbapi2 as sqlite3" to get up and running on this machine. I am still a bit puzzled that I can't tell python's configure script where my sqlite install lives - this is still the optimal solution since I have scripts (and third party dependencies) that rely on "import sqlite3".
Cyrus
The python autoconf and Makefile infrastructure is rather complex and non-standard in many respects, with cruft over many years and supporting many architectures and options. Looking at the code in setup.py (and without any testing or knowing what platform you're building on), it looks like in most cases the easiest option would be to install the desired sqlite3 into /usr/local/{include,lib}. If that's not feasible, adding the include and lib dirs to the configure step should work: ./configure LDFLAGS='-L/path/to/lib' CPPFLAGS="-I/path/to/include' ...
Ned Deily
Cyrus