当前位置: 首页 > 工具软件 > mysqlclient > 使用案例 >

Ubuntu下安装mysqlclient报错

上官砚文
2023-12-01

问题描述

在使用Ubuntu安装mysqlclient报错,安装指令 pip3 install mysqlclient。

错误提示

Collecting mysqlclient
  Using cached https://files.pythonhosted.org/packages/f4/f1/3bb6f64ca7a429729413e6556b7ba5976df06019a5245a43d36032f1061e/mysqlclient-1.4.2.post1.tar.gz
    Complete output from command python setup.py egg_info:
    /bin/sh: 1: mysql_config: not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-8139q6vm/mysqlclient/setup.py", line 16, in <module>
        metadata, options = get_config()
      File "/tmp/pip-build-8139q6vm/mysqlclient/setup_posix.py", line 51, in get_config
        libs = mysql_config("libs")
      File "/tmp/pip-build-8139q6vm/mysqlclient/setup_posix.py", line 29, 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-8139q6vm/mysqlclient/

解决方案

sudo apt-get install libmysqlclient-dev
pip3 install mysqlclient

 类似资料: