報錯內容主要是:python
EnvironmentError: mysql_config not foundmysql
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/nh/j05szmpj19368dd9_y6whgy40000gq/T/pip-install-n9Jonx/mysql-python/sql
網上查了執行一個什麼環境變量的命令:spa
export PATH=$PATH:/usr/local/mysql/bin
而後報了另外一個錯:code
#include "my_config.h"
^~~~~~~~~~~~~
1 error generated.
error: command 'cc' failed with exit status 1blog
最後用了兩個方法ip
一是先執行:get
brew install mysql
注意必定要是經過brew安裝it
二是直接去下載:pip
https://dev.mysql.com/downloads/connector/python/
下載完之後,經過finder能夠訪問到:
/usr/local/mysql/bin 這個文件夾,能夠看到裏面是有一個叫 mysql_config 的文件
因爲我是同時作了這兩件事的,因此沒法判斷到底哪一個是對哪一個是錯,或者均可以,而後再執行一遍:
export PATH=$PATH:/usr/local/mysql/bin
最後再執行 pip install MySQL-Python 就行了
參考:
https://stackoverflow.com/questions/25459386/mac-os-x-environmenterror-mysql-config-not-found