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

python 安装 MySQL-python

时间:2015-05-22 18:37:51      阅读:243      评论:0      收藏:0      [点我收藏+]

标签:

$python
>>> import MySQLdb
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named MySQLdb

 

wget http://jaist.dl.sourceforge.net/project/mysql-python/mysql-python-test/1.2.4b4/MySQL-python-1.2.4b4.tar.gz

tar zxvf MySQL-python-1.2.4b4.tar.gz

pyhton setup.py install

 

$python
>>> import MySQLdb

 

如果报错

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: 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

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

ok

 

python 安装 MySQL-python

标签:

原文地址:http://www.cnblogs.com/wangxusummer/p/4522826.html

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