I am using latest version macOS and homebrew, brew doctor find nothing wrong. and I just use brew install python, brew install python@2 to get latest version of python.
When I type python -c "import sqlite3", I get following error messages:
python2.7 -c "import sqlite3"
130 ↵ Traceback (most recent call last): File "", line 1, in File "/usr/local/Cellar/python@2/2.7.15_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sqlite3/init.py", line 24, in from dbapi2 import * File "/usr/local/Cellar/python@2/2.7.15_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sqlite3/dbapi2.py", line 28, in from _sqlite3 import * ImportError: dlopen(/usr/local/Cellar/python@2/2.7.15_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_sqlite3.so, 2): Symbol not found: _sqlite3_enable_load_extension Referenced from: /usr/local/Cellar/python@2/2.7.15_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_sqlite3.so Expected in: /usr/lib/libsqlite3.dylib in /usr/local/Cellar/python@2/2.7.15_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_sqlite3.sopython -c "import sqlite3"
1 ↵ Traceback (most recent call last): File "", line 1, in File "/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/sqlite3/init.py", line 23, in from sqlite3.dbapi2 import * File "/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/sqlite3/dbapi2.py", line 27, in from _sqlite3 import * ImportError: dlopen(/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_sqlite3.cpython-37m-darwin.so, 2): Symbol not found: _sqlite3_enable_load_extension Referenced from: /usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_sqlite3.cpython-37m-darwin.so Expected in: /usr/lib/libsqlite3.dylib in /usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_sqlite3.cpython-37m-darwin.so
what may cause the problem? I tried to download python source code and compile it, and move the _sqlite3.so or _sqlite3.cpython-37m-darwin.so file into the brew installed folder, and everything works just fine. Could brew just forget something in the formula? What can I do except for compiling .so file from source and manually solve the problem?