3

Whenever I import sqlite3, it gives an import error.

Can anyone tell me how to import sqlite3 for python3>

I'm using CentOS 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'
Paul Rooney
  • 20,879
  • 9
  • 40
  • 61
Danish Arman
  • 1,427
  • 2
  • 8
  • 7

1 Answers1

0

I'm using CentOS 8 and python 3.7.

I found same issue on running my jupyter notebook and solved my issue with this solution.

  1. $ sudo yum install sqlite-devel
  2. $ cd /python_path
  3. $ ./configure
  4. $ make && make install

This solution is re-compile python after install sqlite-devel.