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?

1
  • Can you go to /usr/bin/python3 and run sqlite3 --version? Commented Oct 3, 2020 at 19:38

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

Comments

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.