MAC OS X下安装MySQL-python

首次在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

```

解决办法:

1.从MySQL官网下载并安装MySQL  https://dev.mysql.com/downloads/mysql/

2.在终端terminal中cd 到虚拟环境并启动虚拟环境

在虚拟环境中修改环境变量

(venv)$PATH="$PATH":/usr/local/mysql/bin

3.重启终端,进去虚拟环境并输入

pip install mysql-python

安装完成

你可能感兴趣的:(MAC OS X下安装MySQL-python)