0. brew install mysql
1. brew unlink
mysql
2. brew install mysql-connector-c
3. which mysql_config
4. vim mysql_config文件,找到
libs="$libs -l "
libs="$libs -lmysqlclient -lssl -lcrypto"
5. pip install mysqlclient
6. pip install MySQL-python
7. brew unlink mysql-connector-c
8. brew link mysql
复制代码
常见错误
_mysql.c:36:10: fatal error: 'my_config.h' file not found
#include "my_config.h"
^~~~~~~~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
复制代码
错误原因
1. 未安装mysql-connector-c 缺少对应的库
2. 安装了新版的mysql 默认缺少了my_config文件
这是mysql 8.0.19 默认库文件,确实没有my_config.h,这时候我们需要copy一份
将mysql.h copy 一份重命名为 my_config.h
这时候应该就没问题了。~
也是参考于stackoverflow,附上原链接
stackoverflow
感谢你的时间看完~
FreeCultureBoy
macOS
Node.js
-
6061
-
Marno
Flutter
macOS
Windows
-
714
-
jasonboy7
React.js
Node.js
macOS