在py3中安装mysqlclient时出错[重复]

Posted

技术标签:

【中文标题】在py3中安装mysqlclient时出错[重复]【英文标题】:Error while installing mysqlclient in py3 [duplicate] 【发布时间】:2020-06-20 11:25:19 【问题描述】:
    rohit@rohit:~/Desktop/django_project$ pip3 install mysqlclient
Collecting mysqlclient==1.3.12
  Using cached https://files.pythonhosted.org/packages/6f/86/bad31f1c1bb0cc99e88ca2adb7cb5c71f7a6540c1bb001480513de76a931/mysqlclient-1.3.12.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-6bic4vtr/mysqlclient/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "/tmp/pip-build-6bic4vtr/mysqlclient/setup_posix.py", line 44, in get_config
        libs = mysql_config("libs_r")
      File "/tmp/pip-build-6bic4vtr/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-6bic4vtr/mysqlclient/

我也试过用pip3 install mysqlclient==1.3.12 版本安装,它显示同样的错误。

【问题讨论】:

"mysql_config not found" 你必须用你的操作系统安装程序来安装它。 ***.com/search?q=%5Bpip%5D+mysql_config+not+found 【参考方案1】:

"mysql_config 未找到且 mysql-config 位于不同的包中,可以从以下位置安装

sudo apt-get install libmysqlclient-dev

【讨论】:

以上是关于在py3中安装mysqlclient时出错[重复]的主要内容,如果未能解决你的问题,请参考以下文章

在virtualenv中安装mysqlclient时出错

在 Ubuntu 16.04 中安装 Android Studio 时出错 [重复]

在 R 中安装与 stringr 包相关的包时出错 [重复]

如何在 SLES 12 中安装 mysqlclient?

如何在python中安装mysqlclient?

在 Windows 的 Python 3.6 中安装 mysqlclient