安装 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. C语言指针及占据内存空间

    第一.了解内存空间 本文章文字有点多,会有点枯燥,配合图文一起看可以缓解枯燥,耐心阅读哦!!! 先了解内存地址,才更好的理解指针! 我们可以把内存想象为成一列很长很长的货运火车,有很多大小相同的车厢, ...

  2. Ceph 存储集群2-配置:心跳选项、OSD选项、存储池、归置组和 CRUSH 选项

    一.心跳选项 完成基本配置后就可以部署.运行 Ceph 了.执行 ceph health 或 ceph -s 命令时,监视器会报告 Ceph 存储集群的当前状态.监视器通过让各 OSD 自己报告.并接 ...

  3. Ambari HDP 下 SPARK2 与 Phoenix 整合

    1.环境说明 操作系统 CentOS Linux release 7.4.1708 (Core) Ambari 2.6.x HDP 2.6.3.0 Spark 2.x Phoenix 4.10.0-H ...

  4. 2019全国大学生信息安全大赛两道web

    简单小结 菜鸟第一次打国赛,这次题目质量很高,学到了许多姿势. Web Justsoso 打开题目,源代码出存在提示: 使用LFI读取index.php与hint.php http://d4dc224 ...

  5. gcc和g++的区别:安装、版本、编译(转)

    用以下命令: yum install gcc 安装的只有gcc,而不会安装g++.gcc是编译器合集,而gcc-g++或简称g++则是C++编译器.gcc成为了编译器的选择器.gcc通过识别被编译的源 ...

  6. Python 协程 - Coroutines

    协程 - Coroutines Awaitable Objects, Awaitable Objects 通常由 __await__() 生成, 而 Coroutine objects 是由 asyn ...

  7. 对特殊方法的访问 - Special method lookup

    对特殊方法的访问 - Special method lookup 对于用户自定义的 class 来说, 特殊方法只有通过定义对象的类型object’s type (而非通过 instance 的 __ ...

  8. [redis读书笔记] 第一部分 数据结构与对象 链表

    二 链表 1.链表节点使用ListNode结构,是一个双向的链表,同时,还实现了一个控制所有ListNode的结构list: typedef struct listNode { // 前置节点 str ...

  9. Markdown编写接口文档模版

    接口名称 1) 请求地址 https://apis.cnblogs.com/user/info?a=xx&b=xx 2) 调用方式:HTTP GET 3) 接口描述: 接口描述详情 4) 请求 ...

  10. pytorch-- Attention Mechanism

    1. paper: Learning Phrase Representations using RNN Encoder–Decoder for Statistical Machine Translat ...