python调用mysql报错解决方案

错误提示:

ImportError: dlopen(/Users/XXX/.python-eggs/MySQL_python-1.2.5-py2.7-macosx-10.9-intel.egg-tmp/_mysql.so,

2): Library not loaded: /usr/local/lib/libmysqlclient.18.dylib

Referenced from: /Users/XXX/.python-eggs/MySQL_python-1.2.5-py2.7-macosx-10.9-intel.egg-tmp/_mysql.so

根据提示知道 在本地找不到/usr/local/lib/libmysqlclient.18.dylib文件,通过

find / -name 'libmysqlclient.18.dylib'   查找,

可以看到/usr/local/mysql-5.6.17-osx10.7-x86_64/lib/libmysqlclient.18.dylib有这个文件,


通过软连接

ln -s /usr/local/mysql-5.6.17-osx10.7-x86_64/lib/libmysqlclient.18.dylib /usr/local/lib/libmysqlclient.18.dylib

问题解决

你可能感兴趣的:(python调用mysql报错解决方案)