使用命令 pip install MySQL-python时报错:
Collecting MySQL-python
Using cached https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip
Complete output from command python setup.py egg_info:
sh: mysql_config: command not found
Traceback (most recent call last):
File "", line 1, in
File "/private/var/folders/nx/nzj3snp57xx4y1x012_ptsdr0000gn/T/pip-install-c52UyQ/MySQL-python/setup.py", line 17, in
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_config not found
使用命令find ./ -name mysql_config查找不到mysql_config 文件。
在网上搜了下,很凌乱。
源博客:http://stackoverflow.com/questions/25459386/mac-os-x-environmenterror-mysql-config-not-found
只是做了一些提示,我这里把我解决的过程总结一下:
1.确保安装了python;
2.确保你安装了mysql ,没有安装的话可以在这里下载安装包安装:https://dev.mysql.com/downloads/connector/python/
3.运行命令修改环境变量:export PATH=$PATH:/usr/local/mysql/bin
4.安装MySQL-python:pip install MySQL-python==1.2.5
这种方式解决了我的问题