I cannot import the sqlite3 module in Python version 3.5.0. Here is what I get:
>>> import sqlite3 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'
I know, I know, there is PLENTY from StackOverflow posts and online support forums where people complain about this problem, but none of the published solutions work for me yet. Here where I was:
I also have Python 2.6.6 installed on this server, which runs CentOS 6.8 x86_64. I can open Python REPL and import sqlite3 just fine when using Python 2.6.6. I can also use sqlite3 directly from bash, and nothing seems boring.
This helpful question looked promising. I tried reconfiguring and recompiling Python3.5 with the option --enable-loadable-sqlite-extensions , as the user jammyWolf assumed. No, the same error is still happening.
I use virtual environments such as a good boy, but I have root access to this server. So, I was a bad boy and ran python3 as root without activating virtualenvs. Not lucky yet. Therefore, I do not think this has anything to do with permissions.
I noticed that the error message says No module named '_sqlite3' . This thread assumes that the underscore in front of the module name means that the module is an implementation detail and does not appear in the API .... I'm not sure what to do with this information, but there might be some hint.
Any ideas?
source share