我在mac Sierra上安装了MySQLdb for python
brew install mysql-connector-c
pip install mysql-python
以及https://www.tutorialspoint.com/python/python_database_access.htm
之后我试图导入MySQLdb
>>> import MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/MySQLdb/__init__.py", line 19, in <module>
import _mysql
ImportError: dlopen(/Library/Python/2.7/site-packages/_mysql.so, 2): Library not loaded: /usr/local/opt/mariadb/lib/libmysqlclient.18.dylib
Referenced from: /Library/Python/2.7/site-packages/_mysql.so
Reason: image not found
我已经重新检查了MySQLdb是否已经安装但是它显示的是msg
➜ ~ pip install MySQL-python
Requirement already satisfied: MySQL-python in /Library/Python/2.7/site-packages
我该如何解决这个问题?