by simonw · 2y ago · 0 comments
Short version:
cd /tmp
wget 'https://www.sqlite.org/2024/sqlite-amalgamation-3450000.zip'
unzip sqlite-amalgamation-3450000.zip
cd sqlite-amalgamation-3450000
gcc -dynamiclib sqlite3.c -o libsqlite3.0.dylib -lm -lpthread
DYLD_LIBRARY_PATH=$PWD python3 -c "import sqlite3; print(sqlite3.sqlite_version)"
That prints "3.45.0" for me.If you have https://datasette.io/ installed you can then get a web UI for trying it out by running:
DYLD_LIBRARY_PATH=$PWD datasetteis always updated as part of the release process and is updated periodically between releases.
EDIT: Python 3.9.6 from Xcode doesn't work either. It has _sqlite3.cpython-39-darwin.so which dynamically links /usr/lib/libsqlite3.dylib, but that dylib doesn't exist on my system, and I don't know enough about macOS internals to tell where it's coming from. The _sqlite3 so doesn't seem big enough to have it statically linked.
EDIT2: Xcode's Python works when launching via the real path instead of using the /usr/bin/python3 alias, I assume because /usr/bin is SIP-protected or something.