Python Forum

Full Version: ImportError: No module named '_sqlite3'
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Whenever i'm importing sqlite3, it give an import error. Can anyone tell me how to import sqlite3 for python3. Apart, im using cent os 6.5 on my vps.

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/sqlite3/__init__.py", line 23, in <module>
from sqlite3.dbapi2 import *
File "/usr/local/lib/python3.5/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: No module named '_sqlite3'


Thankew
Did you check if the module is actually installed with your Python interpreter? You can do that with "pip list" command in the console.

It could also mean a version mismatch. e.g. your system has default Python 2, but you downloaded/compiled sqlite3 for Python 3.
Which Python are you using? Did you install it yourself? And how did you install sqlite3?
_sqlite3 ? With underscore at the beginning? No

https://docs.python.org/3.5/library/sqlite3.html

@j.crater, it is a part of the standard library
(Dec-16-2017, 01:06 PM)wavic Wrote: [ -> ]_sqlite3 ? With underscore at the beginning? No

https://docs.python.org/3.5/library/sqlite3.html



That is what caught my attention too. But I did a quick search and the error message does actually return underscored _sqlite3
Hm! I can't reproduce the error. I've looked at dbapi2.py and  /usr/lib/python3.5/sqlite3/__init__.py and the lines pointed at the error message are there.

Did you try to reinstall Python3? OS?
It is per-installed with python 3.6.3, and I believe has been since 2.7