python3下安装mysqlclient各种报错 raise OSError mysql_config not found
在服务器执行
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
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
· 上周热点回顾(2.24-3.2)