1、安装mysql,使用brew或者下载压缩包都可以
brew install mysql
2、下载Mysql-python。链接地址:https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip
3、解压mysql-python.zip,并修改 site.cfg 文件,指定mysql_config路径,在mysql安装目录下
mysql_config = /usr/local/Cellar/mysql/8.0.16/bin/mysql_config
正常安装之后,使用的时候可能会报错:Library not loaded: /usr/local/mysql/lib/libmysqlclient.20.dylib
解决办法:从mysql安装目录链接过来,sudo ln -s /usr/local/Cellar/mysql/8.0.16 /usr/local/mysql
网友评论