Figuring out my sqlite version

10,046

Solution 1

Yes, you have installed the sqlite: 3.13.0-1 version of sqlite database. If you want to check, run sqlite3 --version

import sqlite3
sqlite3.version

Here you get version for DB-API 2.0 interface for SQLite which is 2.6.0

Solution 2

  1. Import sqlite3 into your python script:

    import sqlite3
    
  2. Add the following lines to your script:

    print "SQLite Version is:", sqlite3.sqlite_version
    print "DB-API Version is:", sqlite3.version
    
  3. Running the script produced the following results for me (your results may differ):

    SQLite Version is: 3.11.0
    DB-API Version is: 2.6.0 
    

This information is documented in The Python Standard Library, "Section 12.6.1. Module functions and constants" https://docs.python.org/3/library/sqlite3.html

Share:
10,046
Max Power
Author by

Max Power

Some of my Stack Overflow answers: Plot classifier's decision boundary Parallel Processing of Very Large Text File Pretty-print confusion matrix Consistent one-hot-encoding of data in batch Input shape error for hidden layers of Keras LSTM (RNN) Model Hyperparameter Tuning in Pyhon/Scikit-learn Separately Scale/OHE Numeric/Categorical Columns Scipy integral given function, bounds

Updated on June 09, 2022

Comments

  • Max Power
    Max Power almost 2 years

    I wanted to check which version of sqlite I had, which has become way more confusing than I expected. To start fresh, I created a new conda environment with:

    conda create --name my_env_name python=3.6 sqlite hdf5 pandas
    

    The shell message said it would install sqlite: 3.13.0-1 in the new environment, along with a few other packages.

    Then, after activating that new conda environment, I immediately ran pip freeze, but the list of packages I see does not include any entry for sqlite.

    Finally, I just enter python from the terminal (in this conda env) to enter a system python in my shell. The opening message says python version 3.6.1, confirming I'm in that newly created environment. But then

    import sqlite3
    sqlite3.version
    

    outputs '2.6.0'

    What's going on? Do I have sqlite3 version 3.13 installed or 2.6? If my sqlite3 version is 2.6, how do I get something newer? That would be pretty old.

  • Max Power
    Max Power almost 7 years
    much obliged. SO tells me I need to wait 7 minutes to accept this, will do then.
  • Ganesh
    Ganesh almost 7 years
    @MaxPower I'm new to StackOverflow. When you wrote SO. I was thinking why your significant other told you to wait 7 minutes :-D.