How to check the SQLite version used by Python?
I was working on a Django project where I was facing issues with the SQLite module mismatch while deploying my project on the server.
$python manage.py migrate django.core.exceptions.ImproperlyConfigured: SQLite 3.8.3 or later is required (found 3.7.17)
Basically, server had out of date version of SQLite.
If you are using Django latest version, it requires latest SQLite version.
I contacted hosting support and then they updated SQLite package with latest version. That’s different story.
Note: Django uses the SQLite database for managing project data. You can learn Django web development.
Moving to our actual question.
How to Check SQLite version used by Python?
Here is how you can check the SQLite version command line [step-by-step].
1. Run a Python
$python Python 3.7.3 (default, Apr 12 2019, 16:23:13)
I’m using Python 3.7 version.
2. Import sqlite3 Module
>>> import sqlite3
3. Print the SQLite Version
You can uses
sqlite_version attribute from
>>> sqlite3.sqlite_version '3.27.2'
This will print the SQLite version used by the Python. Here I’m using SQLite version ‘3.27.2’.
Note: You may have multiple Python versions installed on your system and each Python version can have different SQLite versions.
One Line Command to Check SQLite version
You can simply run single command to get the SQLite version using Python ‘-c’ option.
$python -c "import sqlite3; print(sqlite3.sqlite_version)"
If you are using out of date SQLite version, you can update it. Learn more about managing Python modules using pip.
I hope this helps you to check SQLite version used by Python. If you have any questions related to the SQLite Python package, you can ask me in the comment.
Leave a Reply