ImportError: No module named pysqlite2

14,570

The module is called sqlite3. pysqlite2 was the module's name before it became part of the Python standard library.

You probably want to use this in your code:

import sqlite3

And the standard documentation is here: http://docs.python.org/library/sqlite3.html

edit: And just to cover all the bases:

The sqlite3 module also has a dbapi2 sub-member, but you don't need to use it directly. The sqlite3 module exposes all the dbapi2 members directly.

Share:
14,570
jacknad
Author by

jacknad

Electrical Engineer with experience in microprocessor hardware design, ASM, PL/M, C/C++, C#, Android, Linux, Python, and Java. First high school radio design burst into flames during the demo. First software program was FORTRAN on punch cards. Worked in FL, IL, ND, NJ, TX, VA, and WA.

Updated on June 15, 2022

Comments

  • jacknad
    jacknad almost 2 years

    Why does

    from pysqlite2 import dbapi2 as sqlite
    

    cause

    ImportError: No module named pysqlite2

    Isn't pysqlite2 already installed in Python 2.6.5?

  • jacknad
    jacknad almost 12 years
    I see. So I was able to just import sqlite3 and connection = sqlite3.connect('MyDatabase.db') etc. Thanks a million.