在CentOS7.2中,我通过pip3安装了mysql客户端,但是得到了以下错误:
[root@controller src]# pip3 install mysqlclient
Collecting mysqlclient
Using cached mysqlclient-1.3.12.tar.gz
Complete output from command python setup.py egg_info:
/bin/sh: mysql_config: did not find the command
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-1qgj63ha/mysqlclient/setup.py", line 17, in <module>
metadata, options = get_config()
File "/tmp/pip-build-1qgj63ha/mysqlclient/setup_posix.py", line 44, in get_config
libs = mysql_config("libs_r")
File "/tmp/pip-build-1qgj63ha/mysqlclient/setup_posix.py", line 26, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
OSError: mysql_config not found
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-1qgj63ha/mysqlclient/
众所周知,Python3的mysqlclient是Python2的MySQL-python的替代品。但是为什么在CentOS7.2中我无法安装它?
答案 0 :(得分:0)
最后,我发现我应该先安装mysql并进行配置,如果不安装则会出现OSError: mysql_config not found
此错误。
yum install python-devel mysql-community-devel -y