尝试安装mysqlclient
[root@Salve2 WebSite]# pip3 install mysqlclient
报错OSError: mysql_config not found
Collecting mysqlclient
Downloading https://files.pythonhosted.org/packages/6f/86/bad31f1c1bb0cc99e88ca2adb7cb5c71f7a6540c1bb001480513de76a931/mysqlclient-1.3.12.tar.gz (89kB)
100% |████████████████████████████████| 92kB 246kB/s
Complete output from command python setup.py egg_info:
/bin/sh: mysql_config: command not found
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-install-lol94_cv/mysqlclient/setup.py", line 17, in
metadata, options = get_config()
File "/tmp/pip-install-lol94_cv/mysqlclient/setup_posix.py", line 44, in get_config
libs = mysql_config("libs_r")
File "/tmp/pip-install-lol94_cv/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-install-lol94_cv/mysqlclient/
先安装mysql-devel
[root@Salve2 WebSite]# yum install mysql-devel
再次安装mysqlclient
[root@Salve2 WebSite]# pip3 install mysqlclient
成功
Collecting mysqlclient
Using cached https://files.pythonhosted.org/packages/6f/86/bad31f1c1bb0cc99e88ca2adb7cb5c71f7a6540c1bb001480513de76a931/mysqlclient-1.3.12.tar.gz
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient ... done
Successfully installed mysqlclient-1.3.12