Mac是个人工做机,须要作python Web 开发,可是坑爹的是MySQLdb 一直没法正常工做,一气之下我选择从新安装。html
首先是从新安装系统,参考下个连接的文章,而且建议作好time machine备份系统。python
http://www.jb51.net/os/MAC/197626.htmlmysql
安装MySQL 参考下面的连接:http://www.jb51.net/article/56872.htmsql
可是MySQL没法开机自动启动,参考这个帖子:http://www.bitscn.com/pdb/mysql/201411/416628.htmlapi
而后开始安装MySQLdb:http://blog.csdn.net/janronehoo/article/details/25207825测试
可是装完后测试的时候会出现报错:Python mysqldb: Library not loaded: libmysqlclient.18.dylibspa
参看:http://stackoverflow.com/questions/6383310/python-mysqldb-library-not-loaded-libmysqlclient-18-dylib.net
当添加软链接:ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylibcode
会报错,参看下面的解决方案:orm
when you are in EI Capitan, will get error: ln: /usr/lib/libmysqlclient.18.dylib: Operation not permitted
need to close the "System Integrity Protection".
first, reboot and hold on cmd + R to enter the Recovery mode, then launch the terminal and type the command: csrutil diable
, now you can reboot and try again.
再从新测试,应该ok了,再次提醒:要用time machine 作备份。