I would like to have an interface between Python and sqlite. Both are installed on the machine. I had an old version of Python (2.4.3). So, pysqlite was not included by defa
On Windows, _sqlite3.pyd
resides in C:\Python26\DLLs
. On *nix, it should be under a path similar to /usr/lib/python2.6/lib-dynload/_sqlite3.so
. Chances are that either you are missing that shared library or your PYTHONPATH
is set up incorrectly.
Since you said you did not install as a superuser, it's probably a malformed path; you can manually have Python search a path for _sqlite3.so
by doing
import sys
sys.path.append("/path/to/my/libs")
but the preferred approach would probably be to change PYTHONPATH
in your .bashrc
or other login file.
You have a "slite3.py" (actually its equivalent for a package, sqlite3/__init__.py
, so import sqlite3
per se is fine, BUT that module in turns tries to import _sqlite3
and fails, so it's not finding _sqlite3.so
. It should be in python2.6/lib-dynload
under your local Python root, AND ld should be instructed that it has permission to load dynamic libraries from that directory as well (typically by setting appropriate environment variables e.g. in your .bashrc). Do you have that lib-dynload directory? What's in it? What environment variables do you have which contain the string LD (uppercase), i.e. env|grep LD
at your shell prompt?