macOS 上安装 mysql-python 失败

 在 macOS 上安装 mysql-python 失败( pip install MySQL-python )。

问题说明

macOS 上安装 mysql-python 失败( pip install MySQL-python ),报错信息如下:

1
EnvironmentError: mysql_config not found

分析尝试

按照网上提供的解决方案,发现是没有安装 mysql,

install mysql``` 后,修改`bash profile` 增加 ```export PATH
1
2


fatal error: ‘my_config.h’ file not found。

1
2
3
4
5
6
7
8
9
10
11
12

问题看起来是安装过程中,使用了 Clang 库,没找到my_config头文件。

### 解决方案

```shell

brew install mysql (已安装可略过)
brew unlink mysql
brew install mysql-connector-c
brew link --overwrite mysql
pip install MySQL-python