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 作備份。