@ IT·测试

MacOS10.15.5安装mysqlclient报错

2020-06-06  本文已影响0人  码上版码
image.png

解决方法:

解决方法如下:

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:PATH"export LIBRARY_PATH="LIBRARY_PATH:/usr/local/opt/openssl/lib/"

image.png
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="-Lpkglibdir" libs="libs -l "
修改为

Create options

libs="-Lpkglibdir" libs="libs -lmysqlclient -lssl -lcrypto"
保存退出
7)安装pip3 install mysqlclient==1.3.12

image.png
上一篇下一篇

猜你喜欢

热点阅读