【问题标题】:I have try to install pip install mysqlclient on mac give some error?我尝试在 mac 上安装 pip install mysqlclient 出现一些错误?
【发布时间】:2019-11-06 19:15:58
【问题描述】:

弃用:Python 2.7 将于 2020 年 1 月 1 日到期。请升级您的 Python,因为 Python 2.7 在该日期之后将不再维护。未来版本的 pip 将不再支持 Python 2.7。

Collecting mysqlclient
  Using cached https://files.pythonhosted.org/packages/f4/f1/3bb6f64ca7a429729413e6556b7ba5976df06019a5245a43d36032f1061e/mysqlclient-1.4.2.post1.tar.gz
    ERROR: Complete output from command python setup.py egg_info:
    ERROR: sh: mysql_config: command not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/2b/1sy6xpk55qz87d1dx31qn92w0000gn/T/pip-install-ke4S5K/mysqlclient/setup.py", line 16, in <module>
        metadata, options = get_config()
      File "setup_posix.py", line 51, in get_config
        libs = mysql_config("libs")
      File "setup_posix.py", line 29, in mysql_config
        raise EnvironmentError("%s not found" % (_mysql_config_path,))
    EnvironmentError: mysql_config not found
    ----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/2b/1sy6xpk55qz87d1dx31qn92w0000gn/T/pip-install-ke4S5K/mysqlclient/

【问题讨论】:

标签: python django


【解决方案1】:

试试brew install mysql-connector-c。如果您没有安装 brew,请使用 ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 安装它

此外,您应该将开发从 Legacy Python(即 Python 2)切换到 Python 3,因为在 2020 年 1 月 1 日之后将不再支持它。

【讨论】:

    最近更新 更多