python2.7 and sqlite3 were installed by homebrew on macos 10.8
pysqlite is installed by pip
when I type import sqlite3 in python interapter, it show errors below:
>>> import sqlite3
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sqlite3/__init__.py", line 24, in <module>
from dbapi2 import *
File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sqlite3/dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: dlopen(/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_sqlite3.so, 2): Library not loaded: /usr/local/lib/libsqlite3.0.8.6.dylib
Referenced from: /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_sqlite3.so
Reason: image not found
how to correct that error?
asked Mar 24, 2013 at 5:22
Desmond Chen
5026 silver badges17 bronze badges
-
4github.com/mxcl/homebrew/issues/17312root– root2013年03月24日 06:08:43 +00:00Commented Mar 24, 2013 at 6:08
-
On my Mac Python 2.7, pysqlite and Sqlite 3 are installed by default. Couldn't you use those?uselpa– uselpa2013年03月24日 07:28:08 +00:00Commented Mar 24, 2013 at 7:28
-
Why do you install a new version of Python when there are already Pyhon 2.7 installed by default ? It is a problem of Homebrewgene– gene2013年03月24日 09:16:57 +00:00Commented Mar 24, 2013 at 9:16
-
3@gene: because the Python that comes with OS X is usually a few minor versions behind the latest one.Erik Kaplun– Erik Kaplun2013年10月04日 20:06:05 +00:00Commented Oct 4, 2013 at 20:06
1 Answer 1
The solution is to uninstall both the sqlite as well as python kegs:
brew rm sqlite python
and then reinstall Python (which also installs SQLite3 as its dependency):
brew install python
answered Oct 4, 2013 at 20:05
Erik Kaplun
38.5k15 gold badges102 silver badges113 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
default