mac osx 安装mysqlclient报错mysql_config: command not found

  • 环境说明
    macOS High Sierra 10.13.4

  • 详细错误信息如下:

$ pip install mysqlclient
Collecting mysqlclient
  Downloading https://files.pythonhosted.org/packages/6f/86/bad31f1c1bb0cc99e88ca2adb7cb5c71f7a6540c1bb001480513de76a931/mysqlclient-1.3.12.tar.gz (89kB)
    100% |████████████████████████████████| 92kB 171kB/s
    Complete output from command python setup.py egg_info:
    sh: mysql_config: command not found
    Traceback (most recent call last):
      File "", line 1, in 
      File "/private/var/folders/f0/wcdxffsj375_dfjw0qwhvwm80000gn/T/pip-install-e8aa82/mysqlclient/setup.py", line 17, in 
        metadata, options = get_config()
      File "setup_posix.py", line 44, in get_config
        libs = mysql_config("libs_r")
      File "setup_posix.py", line 26, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    EnvironmentError: mysql_config not found

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/f0/wcdxffsj375_dfjw0qwhvwm80000gn/T/pip-install-e8aa82/mysqlclient/
  • 原因:
    系统没有安装mysql

  • 解决方案:
    brew install mysql

yaoel
2018.05.25

参考:

1.Mac OS X - EnvironmentError: mysql_config not found

你可能感兴趣的:(mysql)