2
respostas

Erro ao instalar Flask_mysqldb

Olá ao rodar o código pip3 install flask_mysqldb==0.2.0 recebo o erro abaixo:

pip3 install flask_mysqldb==0.2.0
Collecting flask_mysqldb==0.2.0
  Using cached Flask-MySQLdb-0.2.0.tar.gz
Requirement already satisfied: Flask>=0.10 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from flask_mysqldb==0.2.0)
Collecting mysqlclient (from flask_mysqldb==0.2.0)
  Using cached mysqlclient-1.3.12.tar.gz
    Complete output from command python setup.py egg_info:
    /bin/sh: mysql_config: command not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/ks/01th7knd2s97g3ztrssjsg_00000gn/T/pip-build-jf5mtkd8/mysqlclient/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "/private/var/folders/ks/01th7knd2s97g3ztrssjsg_00000gn/T/pip-build-jf5mtkd8/mysqlclient/setup_posix.py", line 44, in get_config
        libs = mysql_config("libs_r")
      File "/private/var/folders/ks/01th7knd2s97g3ztrssjsg_00000gn/T/pip-build-jf5mtkd8/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 /private/var/folders/ks/01th7knd2s97g3ztrssjsg_00000gn/T/pip-build-jf5mtkd8/mysqlclient/

Como devo proceder?

2 respostas

Olá, Arthur!

Parece que é um problema na instalação do MySQL.

Veja no erro:

    /bin/sh: mysql_config: command not found

Chegou a seguir as instruções de instalação do MySQL do início da aula? https://cursos.alura.com.br/course/flask-upload-persistencia-javascript-jquery/task/33493

Verdade, consegui aqui agora. Obrigado!