Site Overlay

mysql不在默认目录下的mysqlclient安装出错的解决办法

笔者使用的lnmp一键安装包构建的服务器环境,在部署django时,
使用pip install mysqlclient安装client报错:

Complete output from command python setup.py egg_info: /bin/sh: mysql_config: command not found

解决办法:
1)到https://pypi.org 去直接下载该模块文件:
wget https://files.pythonhosted.org/packages/ec/fd/83329b9d3e14f7344d1cb31f128e6dbba70c5975c9e57896815dbb1988ad/mysqlclient-1.3.13.tar.gz

2)解压

tar -zxvf mysqlclient-1.3.13.tar.gz

3)修改vim site.cfg文件:
把原文中#mysql_config = /usr/local/bin/mysql_config
取消注释并改为mysql_config = /usr/local/mariadb/bin/mysql_config(你的数据配置文件所在的位置)

4)安装:
python3 setup.py install

完毕!

Leave a Reply

Your email address will not be published. Required fields are marked *