Mac OS下安装brew
在命令行下执行以下命令
/bin/zsh -c “$(curl -fsSL
https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)”
运行后请按提示进行操作。
安装mysql
brew install mysql
在python2.7中,我们安装的是 MySqldb或这 MySQL-python,能够正却安装,但在python3中,由于 其使用的扩展 ConfigParser 已经改名为 configparser,所以在python3 不能正常按转了。
在 stackoverflow 中的解释:
In Python 3, ConfigParser has been renamed to configparser for PEP 8 compliance. It looks like the package you are installing does not support Python 3.
如果python版本为3.0以上,可以安装 另一个升级版的mysql扩展:mysqlclient
安装:
pip install mysqlclient
注意:
在ubuntu等linux中,我们还要安装 一个系统的library:
sudo apt-get install libmysqlclient-dev