Python import sqlite error

python2.7 and sqlite3 were installed homebrew on macos 10.8
pysqlite is set to peak

When import sqlite3 is entered in the python interface, it shows 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 fix this error?

+7
source share
1 answer

The solution is to remove both sqlite and python kegs:

 brew rm sqlite python 

and then reinstall Python (which also installs SQLite3 as its dependency):

 brew install python 
+6
source

All Articles