相关文章推荐
坐怀不乱的生菜  ·  文件流(fstream, ...·  3 周前    · 
可爱的可乐  ·  Java list remove ...·  1 年前    · 
小胡子的匕首  ·  FOREIGN KEY ...·  1 年前    · 
欢乐的足球  ·  Fabric.js ...·  2 年前    · 
0. brew install mysql
1. brew unlink




    
 mysql # 如果你有安装brew install mysql 的话
2. brew install mysql-connector-c # 安装mysql依赖的一些文件
3. which mysql_config  # 查看本地mysql_config 文件在哪
4. vim mysql_config文件,找到
    libs="$libs -l "
    libs="$libs -lmysqlclient -lssl -lcrypto"
    # 新版本mysql可能已经为替换后的则无需修改
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
私信