0
点赞
收藏
分享

微信扫一扫

Linux上使用pip 安装mysqlclient,pip install mysqlclient==2.0.1遇到的问题:OSError: mysql_config not found


exit status 1:
command: /usr/local/python3/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-n39j9wjd/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-n39j9wjd/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-e9wzw22i
cwd: /tmp/pip-install-n39j9wjd/mysqlclient/
Complete output (12 lines):
/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-install-n39j9wjd/mysqlclient/setup.py", line 15, in <module>
metadata, options = get_config()
File "/tmp/pip-install-n39j9wjd/mysqlclient/setup_posix.py", line 65, in get_config
libs = mysql_config("libs")
File "/tmp/pip-install-n39j9wjd/mysqlclient/setup_posix.py", line 31, in mysql_config
raise OSError("{} not found".format(_mysql_config_path))
OSError: mysql_config not found
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command

解决方法:安装mysql-devel

centos系统使用yum安装 mysql-devel

yum install mysql-devel

ubuntu 系统apt-get 安装libmysqlclient-dev

apt-get update
apt-get upgrade
apt-get install libmysqlclient-dev

debian 系统

apt install -y libmariadbd18
apt install

之后可能还会安装失败,目前看来可能是版本太低的原因,直接安装默认的版本可以成功。

pip install


举报

相关推荐

0 条评论