首次在mac os 下,用pip install MySQL-Python时经常出现如下错误:
sh: mysql_config: command not found
Traceback (most recent call last):
File "setup.py", line 15, in
metadata, options = get_config()
File "/Users/***/Downloads/MySQL-python-1.2.3/setup_posix.py",
line 43, in get_config
libs = mysql_config("libs_r")
File "/Users/***/Downloads/MySQL-python-1.2.3/setup_posix.py",
line 24, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found
经过一翻百度查找,百度表示它知道的解决方法一概都不可行,经过一番尝试,真正的解决方法应该是:
去mysql官网,下载
http://dev.mysql.com/downloads/mysql/
mysql并且安装
安装完成后,打开终端,输入下方语句修改环境变量:
PATH="$PATH":/usr/local/mysql/bin
好了,现在重启终端,并输入
pip install mysql-python
然后问题就顺利解决了。