python3下安装mysqlclient各种报错 raise OSError mysql_config not found

linux下载地址:https://files.pythonhosted.org/packages/a5/e1/e5f2b231c05dc51d9d87fa5066f90d1405345c54b14b0b11a1c859020f21/mysqlclient-2.0.1.tar.gz#sha256=fb2f75aea14722390d2d8ddf384ad99da708c707a96656210a7be8af20a2c5e5

在服务器执行

pip install mysqlclient-2.0.1.tar.gz```


报错

Processing ./mysqlclient-2.0.1.tar.gz     Complete output from command python setup.py egg_info:     /bin/sh: mysql_config: command not found     /bin/sh: mariadb_config: command not found     /bin/sh: mysql_config: command not found     Traceback (most recent call last):       File "<string>", line 1, in <module>       File "/tmp/pip-8svitbbv-build/setup.py", line 15, in <module>         metadata, options = get_config()       File "/tmp/pip-8svitbbv-build/setup_posix.py", line 65, in get_config         libs = mysql_config("libs")       File "/tmp/pip-8svitbbv-build/setup_posix.py", line 31, in mysql_config         raise OSError("{} not found".format(_mysql_config_path))     OSError: mysql_config not found 执行如下

```bash
yum install mysql-devel gcc gcc-devel python-devel```


   又报错:

MySQLdb/_mysql.c:46:20: fatal error: Python.h: No such file or directory      #include "Python.h"                         ^     compilation terminated.     error: command 'gcc' failed with exit status 1

还是官网最靠谱,可能以上都不用装

```bash
$ sudo apt-get install python3-dev default-libmysqlclient-dev build-essential # Debian / Ubuntu
% sudo yum install python3-devel mysql-devel # Red Hat / CentOS```


在服务器执行

```bash
pip install mysqlclient-2.0.1.tar.gz```


Processing ./mysqlclient-2.0.1.tar.gz Installing collected packages: mysqlclient   Running setup.py install for mysqlclient ... done Successfully installed mysqlclient-2.0.1  
posted @   木头左  阅读(12)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)
点击右上角即可分享
微信分享提示