安装 mysqlclient 报 mysql_config not found

raise EnvironmentError("%s not found" % (mysql_config.path,))
OSError: mysql_config not found

发现原来是用 apt 安装的 mysql 的 mysql_config 文件缺失了,

需要安装 libmysqld-dev 和 libmysqlclient-dev 两个包。

如果安装时少了 libmysqld-dev 就会报这个错,

n__=1.3.12 -I/usr/include/mysql -I/usr/include/python3.6m -c _mysql.c -o build/temp.linux-x86_64-3.6/_mysql.o
_mysql.c: In function ‘_mysql_ConnectionObject_ping’:
_mysql.c:1894:3: error: unknown type name ‘my_bool’; did you mean ‘_Bool’?
my_bool recon = reconnect;
^~~~~~~
_Bool
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-p5vupszb/mysqlclient/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-q5zxo5am/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-install-p5vupszb/mysqlclient/

如果安装 libmysqld-dev 出现依赖关系的 bug,就要安装正确的依赖版本:

下列软件包有未满足的依赖关系:
libmysqld-dev : 依赖: libmysqlclient-dev (>= 5.7.22-0ubuntu18.04.1) 但是它将不会被安装
E: 无法修正错误,因为您要求某些软件包保持现状,就是它们破坏了软件包间的依赖关系。

根据提示 libmysqlclient-dev (>= 5.7.22-0ubuntu18.04.1)可以安装:

sudo apt install libmysqlclient-dev=5.7.22-0ubuntu18.04.1

最后再重新安装 mysqlclient

sudo pip install mysqlclient --user

安装 mysqlclient 报 mysql_config not found的更多相关文章

  1. Mac OS 下安装mysqlclient报“mysql_config not found”的解决

    如问题所示,应该是你没有将mysql_config所在文件夹加入系统的PATH路径,解决方案下: 1.第一步找到你的mysql_config所在位置 1.1. 如果是直接安装mysql,所在位置应该是 ...

  2. 安装mysqlclient报OSError: mysql_config not found

    输入命令: :~$ pip install mysqlclient 报错: Collecting mysqlclient Using cached https://files.pythonhosted ...

  3. pip 安装mysqlclient报错OSError: mysql_config not found

    执行 pip install mysqlclient 报错信息如下: [root@CentOS7-demo bin]# pip install mysqlclient Collecting mysql ...

  4. Ubuntu 下安装mysqlclient报错

    pip3 install mysqlclient 报错信息 问题描述: Complete output from command python setup.py egg_info: /bin/sh: ...

  5. linux安装mysqlclient报错

    错误信息 Collecting mysqlclient Using cached mysqlclient-1.3.12.tar.gz Complete output from command pyth ...

  6. 关于linux下安装mysqlclient报 Failed building wheel for mysqlclient问题

    导入下列依赖包,搞定 sudo apt-get install python3 python-dev python3-dev build-essential libssl-dev libffi-dev ...

  7. mac下安装mysqlcient 报错

    一.我在mac下pip3安装mysqlclient 报错: pip3 install mysqlclient Collecting mysqlclient Using cached mysqlclie ...

  8. 解决安装mysqlclient出现问题:mysql_config: not found

    解决安装mysqlclient出现如下问题: Complete output from command python setup.py egg_info: /bin/sh: : mysql_confi ...

  9. 安装mysqlclient的时候出现Microsoft Visual C++ 14.0 is required报错

    在安装mysqlclient的时候出现了以下报错: 解决办法: 1.到提示网址:https://visualstudio.microsoft.com/download/里面下载对应VC++版本安装后继 ...

随机推荐

  1. oracle问题之死锁 (一)

    [前言] 遇到 oracle 异常 和 解决实践 系列文章 整理分享 杂症一.oracle死锁 一.症状: 执行SQL或程序时,程序没有响应或SQL执行一直处于执行状态,没有成功,也没有报错. 二.病 ...

  2. 曹工说Spring Boot源码(15)-- Spring从xml文件里到底得到了什么(context:load-time-weaver 完整解析)

    写在前面的话 相关背景及资源: 曹工说Spring Boot源码(1)-- Bean Definition到底是什么,附spring思维导图分享 曹工说Spring Boot源码(2)-- Bean ...

  3. TensorFlow中使用GPU

    TensorFlow默认会占用设备上所有的GPU以及每个GPU的所有显存:如果指定了某块GPU,也会默认一次性占用该GPU的所有显存.可以通过以下方式解决: 1 Python代码中设置环境变量,指定G ...

  4. Hanoi塔问题——递归

    /////////////Hanoi塔问题///////#include<iostream>using namespace std;void hanoi(int i,char A,char ...

  5. lwip eth插拔网线自动维护接口状态

    硬件连线就是将dp83848的INT脚连到STM32的某个中断脚上,这里是PB14 PB14的中断处理函数中,会释放一个信号量,这里只是发生链路状态改变中断(网线插上或拔下) void EXTI15_ ...

  6. pos 访问超时 windows连接超时 497 天后未关闭 TIME_WAIT

    问题描述: nginx连接后台tomcat程序 一直报错 nginx的error日志如下 // :: [error] #: *: A connection attempt failed because ...

  7. golang-练习ATM

    package main import "fmt" var ( action int loop bool = true save_money int money int draw_ ...

  8. Linux文本界面字体颜色修改

    环境 基于centos 6.5 在文本界面 系统目录的字体颜色是 黑底蓝字  严重看不清楚,对此作出修改 使用 vi 编辑   进入  /etc/DIR_COLORS 找到“DIR 01;34   # ...

  9. 一键安装apache-2.4.38脚本

    [root@lamp scripts]# cat /etc/redhat-release CentOS Linux release 7.5.1804 (Core) [root@lamp scripts ...

  10. VMware克隆Linux虚拟机报错

    在VMware里克隆了2个centos6.5,执行命令重启网卡服务报以下错误: Bringing up interface eth0: Device eth0 does not seem to be ...