Python 安装mysqlclient时出错

Python 安装mysqlclient时出错,python,mysql-connector,Python,Mysql Connector,我想在centos 8上运行django应用程序,当通过requirements.txt安装依赖项时,我不断收到一个错误,我认为它来自mysqlclient==1.3.12。我试图编辑版本1.3.13,结果相同。这是实际的错误消息。从命令python setup.py egg_info完成输出: /bin/sh: mysql_config: command not found Traceback (most recent call last): File "

我想在centos 8上运行django应用程序,当通过requirements.txt安装依赖项时,我不断收到一个错误,我认为它来自mysqlclient==1.3.12。我试图编辑版本1.3.13,结果相同。这是实际的错误消息。从命令python setup.py egg_info完成输出:

    /bin/sh: mysql_config: command not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-9x7ed00h/mysqlclient/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "/tmp/pip-build-9x7ed00h/mysqlclient/setup_posix.py", line 44, in get
_config
        libs = mysql_config("libs_r")
      File "/tmp/pip-build-9x7ed00h/mysqlclient/setup_posix.py", line 26, in mys
ql_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-9x
7ed00h/mysqlclient/
(afol) [vagrant@localhost ScrumMaster]$
/bin/sh:mysql\u config:command未找到
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
文件“/tmp/pip-build-9x7ed00h/mysqlclient/setup.py”,第17行,在
元数据,options=get_config()
get中第44行的文件“/tmp/pip-build-9x7ed00h/mysqlclient/setup_posix.py”
_配置
libs=mysql\u config(“libs\u r”)
文件“/tmp/pip-build-9x7ed00h/mysqlclient/setup_posix.py”,第26行,在mys中
ql_配置
raise环境错误(“%s未找到”%)(mysql\u config.path,)
操作错误:未找到mysql\u配置
----------------------------------------
命令“python setup.py egg_info”失败,错误代码为/tmp/pip-build-9x中的1
7ed00h/mysqlclient/
(afol)[vagrant@localhostScrumMaster]$

mysqlclient包依赖于C系统库,因此我建议运行以下程序:

sudo apt-get install libmysqlclient-dev
pip3 install mysqlclient