Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to run the sqlite3 module on python 2.6 in an ubuntu system. How do I install this module for Python 2.6?

Somehow I don't have this module, it raises the error:

Python 2.6.5 (r265:79063, Mar 20 2010, 18:48:10) 
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.6/sqlite3/", line 24, in <module>
    from dbapi2 import *
  File "/usr/local/lib/python2.6/sqlite3/", line 27, in <module>
    from _sqlite3 import *
ImportError: No module named _sqlite3
share|improve this question
up vote 3 down vote accepted

File "/usr/local/lib/python2.6/sqlite3/", line 24, in

That is not the python that comes with Ubuntu. either:

  • Install libsqlite3-dev and re-build that version of python, or
  • use /usr/bin/python
share|improve this answer
ohh, I have not known that the python 2.6 is preinstalled with ubuntu 9. thanks for that ;) – Hoang Pham Mar 22 '10 at 13:19

It's probably sudo aptitude install python2.6-sqlite, depending on which version of Ubuntu you're running. You may need to update your packages first if you don't do that regularly (sudo aptitude update).

Do you have the appropriate sqlite3 packages installed? If you do dpkg -l | egrep sqlite3 I'd expect at least 3 packages to show up, including sqlite3 and libsqlite3-0. You may also need python2.6-pysqlite2.

Try sudo aptitude install python2.6-pysqlite2 sqlite3 libsqlite3-0

share|improve this answer
hi Cry, it is the same error. There is nothing changed. My ubuntu version is: Ubuntu 9.10 - the Karmic Koala - released in October 2009 and supported until April 2011. – Hoang Pham Mar 20 '10 at 19:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .