View All Posts. MiCHiLU.com powered by Django ;-)

[Python]: Mac OSX に pysqlite2 を入れる時のメモ

Mac OSX に pysqlite2 を入れたけれども ImportError: Symbol not found: _sqlite3_enable_shared_cache となってしまった時の対処メモ。 バンドルされている SQLite を上書きして入れ直す。 see pysqliteを入れるのにすごく苦労した話

>>> from pysqlite2 import test
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/pysqlite2/test/__init__.py", line 25, in ?
    from pysqlite2.test import dbapi, types, userfunctions, factory, transactions,\
  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/pysqlite2/test/dbapi.py", line 26, in ?
    import pysqlite2.dbapi2 as sqlite
  File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/pysqlite2/dbapi2.py", line 27, in ?
    from pysqlite2._sqlite import *
ImportError: dlopen(/System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/pysqlite2/_sqlite.so, 2): Symbol not found: _sqlite3_enable_shared_cache
  Referenced from: /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/pysqlite2/_sqlite.so
  Expected in: dynamic lookup
$ curl -O http://www.sqlite.org/sqlite-3.3.17.tar.gz
$ tar xzvfp sqlite-3.3.17.tar.gz
$ mkdir bld
$ cd bld
$ ../sqlite-3.3.17/configure --prefix=/usr
$ make
$ sudo make install

$ cd ../
$ curl -O http://initd.org/pub/software/pysqlite/releases/2.3/2.3.3/pysqlite-2.3.3.tar.gz
$ tar xzvfp pysqlite-2.3.3.tar.gz
$ cd pysqlite-2.3.3
$ python2.3 setup.py build
$ sudo python2.3 setup.py install

$ python2.3
Python 2.3.5 (#1, Mar 20 2005, 20:38:20)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1809)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pysqlite2 import test
>>> test.test()
.............................................................................................................................................................................
----------------------------------------------------------------------
Ran 173 tests in 0.830s

OK
>>>
Wed, 23 May 2007 01:17:37 +0900 source edit
Creative Commons License
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.1 Japan License.
View All Posts. MiCHiLU.com powered by Django ;-)