Using SQLite3 with python 2.5 beta

Tim Heaney theaney at gmail.com
Thu Jun 22 22:23:39 EDT 2006


Harold Shore <hshore at 1st-spot.net> writes:

> From the release notes I read that
>
> "If you're compiling the Python source yourself, note that 
> the source tree doesn't include the SQLite code, only the 
> wrapper module. You'll need to have the SQLite libraries 
> and headers installed before compiling Python, and the build 
> process will compile the module when the necessary headers 
> are available."
>
> I do have SQLite3 installed on my system, but after doing a 
> plain vanilla compilation of the the 2.5 beta and trying 
> the SQLite code given in the release notes I get the message 
> "NameError: name 'sqlite3' is not defined".
>
> I wonder what the requirement means that "when the necessary 
> headers are available"?  How would they need to be made 
> available?
>
> Does anyone have any success with this?

It seems to work okay for me. 

  $ python2.5
  Python 2.5b1 (r25b1:47027, Jun 21 2006, 19:41:51) 
  [GCC 4.0.2 20051125 (Red Hat 4.0.2-8)] on linux2
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import sqlite3
  >>> sqlite3.sqlite_version
  '3.1.2'

On my system, the header file is

  /usr/include/sqlite3.h

and the library file is

  /usr/lib64/libsqlite3.so

Those are both standard locations, so configure found them on its
own. If they are someplace unusual, you'll have to tell configure
where they are. It's possible you have SQLite3 installed, but you lack
the header. My system uses RPM, so I had to install both sqlite
and sqlite-devel before building Python. The sqlite-devel package
contains the header.

I hope this helps,

Tim



More information about the Python-list mailing list