python - DB - mysqlclient安装

1. windows环境:

pycharm中,terminal使用以下命令:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple requests mysqlclient

 

排坑:

安装了一个3.8版本的Python,折腾了一天,怎么都装不上。换成Python3.7, ok~

 

 

2. mac环境

mac上执行pip install -i https://pypi.tuna.tsinghua.edu.cn/simple requests mysqlclient报错如下:

 解决步骤:

1)打开终端,安装mysql-connector-c

brew install mysql-connector-c

此过程较慢,大约会持续2个小时左右

2)在~/.bash_profile中加入mysql.的路径

export PATH=${PATH}:/usr/local/Cellar/mysql-client/8.0.19/bin/
source .bash_profile # 使配置文件生效

3)安装mysqlclient

pip3 install mysqlclient

4) 创建软链接

ln -s /usr/local/Cellar/mysql-client/8.0.19/bin/mysql_config /usr/local/bin/mysql_config

5)再次安装,成功~

 

posted @ 2020-10-09 16:30  小虫虫大虫虫  阅读(894)  评论(0编辑  收藏  举报