码迷,mamicode.com
首页 > 数据库 > 详细

Python写入连接mysql失败

时间:2017-08-15 20:59:23      阅读:248      评论:0      收藏:0      [点我收藏+]

标签:bsp   framework   ons   logs   连接数   连接   blog   style   sql   

执行如下连接数据库的语句:

engine = create_engine(mysql://root:root@127.0.0.1/stock?charset=utf8)

报错如下:

ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/_mysql.cpython-35m-darwin.so, 2): Library not loaded: libmysqlclient.18.dylib
  Referenced from: /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/_mysql.cpython-35m-darwin.so
  Reason: image not found

 

解决办法:

sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/local/lib/libmysqlclient.18.dylib

 

参考Stack Overflow:https://stackoverflow.com/questions/6383310/python-mysqldb-library-not-loaded-libmysqlclient-18-dylib

 

Python写入连接mysql失败

标签:bsp   framework   ons   logs   连接数   连接   blog   style   sql   

原文地址:http://www.cnblogs.com/zhzhang/p/7367350.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!