Mac下安装mysqlclient出错解决「mysql_config not found」

错误信息如下图

解决方法

  • 安装mysql-client
brew install mysql-client
  • 设置环境变量
export PATH=$PATH:/usr/local/Cellar/mysql-client/8.0.21/bin/
  • 重新安装mysql-client成功
(dj_new) ╭─dapeng at Liu的MacBook Pro in ~/Desktop/code/Git/music_site/music_site on master✘✘✘ using
╰─± pip install mysqlclient

Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple/
Collecting mysqlclient
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/a5/e1/e5f2b231c05dc51d9d87fa5066f90d1405345c54b14b0b11a1c859020f21/mysqlclient-2.0.1.tar.gz (87 kB)
Building wheels for collected packages: mysqlclient
  Building wheel for mysqlclient (setup.py) ... done
  Created wheel for mysqlclient: filename=mysqlclient-2.0.1-cp39-cp39-macosx_10_15_x86_64.whl size=55861 sha256=494663a05253ee88b3a81c4c4d27ad0c1de147503526fcd6c6836fde48d3c23c
  Stored in directory: /Users/dapeng/Library/Caches/pip/wheels/1b/c5/f1/4e8753a2dbe2cded81d8c46408dab0a755e4b02f7187b4cf60
Successfully built mysqlclient
Installing collected packages: mysqlclient
Successfully installed mysqlclient-2.0.1
posted @ 2020-11-13 00:37  丹华抱一鷇音子  阅读(428)  评论(0编辑  收藏  举报