在python中,导入MySQLdb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.10-intel.egg/MySQLdb/__init__.py", line 19, in <module>
import _mysql
ImportError: dlopen(/Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.10-intel.egg/_mysql.so, 2): Library not loaded: /usr/local/mysql/lib/libmysqlclient.18.dylib
Referenced from: /Library/Python/2.7/site-packages/MySQL_python-1.2.4b4-py2.7-macosx-10.10-intel.egg/_mysql.so
Reason: image not found
我尝试ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
和其他解决方案,但没有任何帮助。
我的电脑是OS X El Capitan,python2.7.9 django1.8.2 mysql-5-7-15
答案 0 :(得分:0)
我正在使用ubuntu 16.04而且我没有你指定的同一个地方的lib。
对我来说最好的解决方案是使用--no-binary
选项安装mysql pip包,如post reply