EnvironmentError:在安装mysql-python时,在Mac OS上找不到mysql_config

时间:2019-01-08 06:06:19

标签: python mysql macos mysql-python

我正在 Mac上使用 Pipenv Django 项目中安装 MySQL-python =“ == 1.2.5” 操作系统Mojave

我通过删除早期的最新安装和mysql数据文件,使用 brew 安装了 mysql@5.7

brew install mysql@5.7

我还添加了以下导出到〜/ .zshrc 文件

export PATH="/usr/local/opt/mysql@5.7/bin:$PATH" export LDFLAGS="-L/usr/local/opt/mysql@5.7/lib" 
export CPPFLAGS="-I/usr/local/opt/mysql@5.7/include" 
export PKG_CONFIG_PATH="/usr/local/opt/mysql@5.7/lib/pkgconfig"

酿造安装日志

中所述
mysql@5.7 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have mysql@5.7 first in your PATH run:
  echo 'export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"' >> ~/.zshrc

For compilers to find mysql@5.7 you may need to set:
  export LDFLAGS="-L/usr/local/opt/mysql@5.7/lib"
  export CPPFLAGS="-I/usr/local/opt/mysql@5.7/include"

For pkg-config to find mysql@5.7 you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/mysql@5.7/lib/pkgconfig"


To have launchd start mysql@5.7 now and restart at login:
  brew services start mysql@5.7

还可以使用

source ~/.zshrc

但是跑步

pipenv install MySQL-Python

出现错误

Complete output from command python setup.py egg_info:
    sh: mysql_config: command not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/hm/_vggn2js0zd098lsj06vww2c0000gn/T/pip-install-asAmtV/mysql-python/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "setup_posix.py", line 43, in get_config
        libs = mysql_config("libs_r")
      File "setup_posix.py", line 25, 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/hm/_vggn2js0zd098lsj06vww2c0000gn/T/pip-install-asAmtV/mysql-python/

运行where mysql_config给出

/usr/local/opt/mysql@5.7/bin/mysql_config
/usr/local/opt/mysql@5.7/bin/mysql_config

0 个答案:

没有答案