3

Python 2.7.3 on Mac OS X Snow Leopard (downloaded from python.org), tells me it is using sqlite 3.6.12 (sqlite3.sqlite_version). However, to use foreign keys, I need at least sqlite 3.6.19.

How can I update sqlite alone?

I already tried pip install pysqlite (from this question/answer: Updating the SQLite3 build on my python install), but the sqlite_version did not change. pip search sqlite shows pysqlite 2.6.3 is installed, but I still have, both from commands python and python2.7

>>> import sqlite3
>>> sqlite3.sqlite_version  #3.6.12
>>> sqlite3.version         #2.6.0 (yeah, no 2.6.3)
Community
  • 1
  • 1
jpimentel
  • 694
  • 1
  • 7
  • 23

1 Answers1

0

You'll first need to install SQLite, then build and install pysqlite, making sure that it's building against your newly installed version of sqlite and not the system's version of sqlite. Alternately, if pysqlite is dynamically linked, you might be able to fiddle with LD_LIBRARY_PATH to make your existing pysqlite load the newer version of the library.

For more, see: https://groups.google.com/group/python-sqlite/browse_thread/thread/9fb6694c803431eb

David Wolever
  • 148,955
  • 89
  • 346
  • 502
  • Thanks, I see that there's no other way than that. It's actually much simpler to manually enforce the foreign keys by code, so I guess that's what I'll do. – jpimentel Jun 15 '12 at 14:50
  • Via your Google Groups link I found http://trac.edgewall.org/wiki/PySqlite , which recommends against Macs doing a static build ("Users of Mac OS X please take care; the Apple-supplied SQLite contains additional code to support..."). But install-source.txt mentions nowhere the standard sqlite3 module, just pysqlite2. Ick! Question: How do I use the LD_LIBRARY_PATH trick? – Matthew Cornell Mar 05 '13 at 02:50
  • 1
    "making sure that it's building against your newly installed version of sqlite and not the system's version of sqlite" this is exactly what I need to do (I have sqlite from homebrew I want to link against), can you please explain how to or point to some docs? – Anentropic Dec 10 '13 at 16:24