##一.用pip安装MySQL-python会爆出以下错误
sudo pip install MySQL-python Traceback (most recent call last): File "setup.py", line 15, in <module> metadata, options = get_config() File "/home/software/MySQL-python-1.2.3/setup_posix.py", line 43, in get_config libs = mysql_config("libs_r") File "/home/software/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
##二.如何解决
###1) 从pypi上下载MySQL-python包
wget https://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.5.zip \ \#md5\=654f75b302db6ed8dc5a898c625e030c
###2) 解压
unzip MySQL-python-1.2.5.zip cd MySQL-python-1.2.5
###3) 查找mac中mysql_config的路径
MySQL-python-1.2.5 sudo find / -name mysql_config Password: find: /dev/fd/3: Not a directory find: /dev/fd/4: Not a directory /usr/local/mysql-5.1.73-osx10.6-x86_64/bin/mysql_config
由此可见mac中的mysql_config路径在/usr/local/mysql-5.1.73-osx10.6-x86_64/bin/mysql_config
###4) 修改setup_posix.py文件:
mysql_config.path = "/usr/local/mysql-5.1.73-osx10.6-x86_64/bin/mysql_config"
###5) 安装
sudo python setup.py install
自此就安装完毕。