如题mac下pip安装MySQL-python报mysql_config not found错误
1 2 3 4 5 6 7 8 9 10 |
sh: mysql_config: command not found Traceback (most recent call last): File "<string>", line 1, in <module> File "/private/var/folders/w3/g_zwb50d323db4lfk767fl880000gn/T/pip-build-V48ZS2/MySQL-python/setup.py", line 17, in <module> metadata, options = get_config() File "setup_posix.py", line 43, in get_config libs = mysql_config("libs_r") File "setup_posix.py", line 25, in mysql_config raise EnvironmentError("%s not found" % (mysql_config.path,)) EnvironmentError: mysql_config not found |
解决办法
确保已经安装mysql,没有安装使用brew install mysql即可 (brew需要提前安装)
下载MySQL-python-1.2.5.zip安装包,解压后修改site.cfg的13行
1 |
mysql_config = /usr/local/mysql-5.7.17-macos10.12-x86_64/bin/mysql_config |
其中
1 |
/usr/local/mysql-5.7.17-macos10.12-x86_64/bin/mysql_config 可根据 locate mysql_config命令获得 |
然后分别执行 python setup.py build 和 python setup.py install 安装MySQL-python即可