安装mysqlclient报mysql_config not found
程序员文章站
2022-05-29 11:34:35
...
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
上一篇: dom4j读写xml文件
下一篇: mysqlclient安装苦逼之路
推荐阅读
-
Linux centOS编译安装Apache报APR not found.错误的解决办法
-
ubuntu安装MySQL-python出现EnvironmentError: mysql_config not found错误
-
安装pip install mysqlclient 解决mysql_config:command not found
-
pip install mysqlclient 报错 OSError: mysql_config not found
-
最新brew安装nvm报nvm command not found解决方案
-
mac下node.js 安装express后报express command not found
-
安装mysqlclient报OSError: mysql_config not found
-
Mac 安装mysqlclient报错,OSError: mysql_config not found 的解决方法
-
Linux centOS编译安装Apache报APR not found.错误的解决办法
-
解决mac os上pip安装mysqlclient失败的问题:library not found for -lgsl(lssl)