6

I have CentOS 6 on my system and I'm trying to update SQLite for Python. I've installed it from source and executing sqlite --version returns version 3.33.0 as expected.

However, when I try to check the python SQLite version using import sqlite3; sqlite3.sqlite_version; I still get the previous SQLite version 3.6.20.

Software Locations:
     Python 3.6.9 - /usr/bin/python3
     Sqlite3 - /usr/bin/sqlite3

I've tried the solution here, this does not work at all, after updating LD_LIBRARY_PATH and checking the python SQLite version it still gives '3.6.20', and here, when I try sudo LD_RUN_PATH=, it gives me the error No such file or directory, but when I execute it without sudo LD_RUN_PATH=, it successfully compiles but still gives me SQLite '3.6.20' (Compiled python without uninstalling). changing LD_LIBRARY_PATH

Note: I have multiple python3 versions.

enter image description here

What can I do to resolve this?

Trollsors
  • 492
  • 4
  • 17

2 Answers2

0

When I did it (specifically trying to find a way to update sqlite3 for a running python program; did not work...), I compiled sqlite and got libsqlite3.so.0.8.6, and then replaced the system-wide sqlite3 with that. For me on debian, that was in /usr/lib/x86_64-linux-gnu. I did see (though now I can't find where) that this way may cause issues when updating in the future. It did update python's sqlite3 for me though.

Sarol
  • 141
  • 3
0

You can import specific versions:

__requires__= 'sqlite3==3.6.20'
import pkg_resources
pkg_resources.require("sqlite3==3.6.20")
import sqlite

Note that this only works on the first import. If sqlite gets imported before pkg_resources, it will take the latest version.

sbluhm
  • 13
  • 2