解决方法:
解决方法如下:
1)首先需要进行Python的安装
~/.bash_profile加入mysql.的路径
添加/usr/local/mysql/bin
PATH /Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/mysql/bin
export PATH
设置python3.6默认
alias python="/usr/local/bin/python3.6"
2)安装Homebrew:Mac OS X 10.15.5 安装 HomeBrew
3)安装mysql:Mac OS X 10.15.5安装mysql8.0.11
4)设置环境变量:
export PATH=$PATH:/usr/local/mysql/bin
5)安装 brew install mysql-connector-c
image.png先安装homebrew,参考文档“安装Homebrew”
终端输入:brew install mysql-connector-c
image.png安装成功
配置环境变量
export PATH="/usr/local/opt/mysql-client/bin:LIBRARY_PATH:/usr/local/opt/openssl/lib/"
6)找不到mysql_config一般是由于通过lnmp.org或者其他方式安装mysql以后mysql_config是在
/usr/local/mysql/bin/
里面,这里面的文件不是在任意位置都可以访问的
终端输入:ln -s /usr/local/mysql/bin/mysql_config /usr/local/bin/mysql_config
vim mysql_config
将
Create options
libs="-Llibs -l "
修改为
Create options
libs="-Llibs -lmysqlclient -lssl -lcrypto"
保存退出
7)安装pip3 install mysqlclient==1.3.12
网友评论