Reputation: 81
I need to upgrade the sqlite3 version that my python 3 uses but there seems to be no clear answers and I don't understand what determines the version of sqlite3 used by python. I am running CentOS7 with python 3.6.4 installed. CentOS had sqlite version 3.7.17 installed and I upgraded this to 3.23.1 thinking python would also use this never version of sqlite.
import sqlite3
print(sqlite3.sqlite_version)
The following code still gives me 3.17. I have googled how to upgrade the version but most solutions seem to refer to pysqlite which is python 2 only. Other solutions talk about complicated compiling processes that go way over my head.
I don't understand what determines the sqlite version that python uses. Is it determined by the python version, OS installed sqlite version? I am also running python 3.6.4 on my windows PC and it says I am running 3.14.2 so it seems that the sqlite version does not depend on the python version.
What determines the sqlite version python uses? Is there not a more straight forward way to upgrade the sqlite version for python 3?
Upvotes: 7
Views: 8471
Reputation: 40838
In Ubuntu, you can add dqlite
repository and update it using apt
.
sudo add-apt-repository -y ppa:dqlite/stable
sudo apt update
sudo apt install sqlite3
Upvotes: 1
Reputation: 99
sqlite3 is kind of external library. so, you need to set external library path.
try next command
printenv LD_LIBRARY_PATH
result will be empty, if you never set before.
next command will work using installed sqlite3 for python
export LD_LIBRARY_PATH="/usr/local/lib"
then, you can execute and get correct version you installed
import sqlite3
print(sqlite3.sqlite_version)
but this method will be reset when you logout and login again. so, if you want to do regist that environment variable every time you login, you should edit /etc/profile
sudo vi /etc/profile
and add export code
export LD_LIBRARY_PATH="/usr/local/lib"
then, if you log-out and log-in again, you can see LD_LIBRARY_PATH is registered.
Upvotes: 9