Solucionado (ver solução)
Solucionado
(ver solução)
4
respostas

Problemas em instalar flask_mysqldb (LinuxMint)

Pessoal, procurei nos tópicos alguma solução para o meu problema e não encontrei... Estou utilizando o LinuxMint, flask==0.12.2, dentro do PyCharm tentei executar o comando para instalar o flask_mysqldb está dando um erro e não consegui descobrir o motivo.

(venv) pip3 install flask_mysqldb==0.2.0

Collecting flask_mysqldb==0.2.0 Using cached https://files.pythonhosted.org/packages/62/e3/955c845efe1aacf30c8e2607470544ede36aa1044f6382c809f13e014104/Flask-MySQLdb-0.2.0.tar.gz Requirement already satisfied: Flask>=0.10 in ./venv/lib/python3.7/site-packages (from flask_mysqldb==0.2.0) (0.12.2) Collecting mysqlclient (from flask_mysqldb==0.2.0) Using cached https://files.pythonhosted.org/packages/f4/f1/3bb6f64ca7a429729413e6556b7ba5976df06019a5245a43d36032f1061e/mysqlclient-1.4.2.post1.tar.gz Complete output from command python setup.py egg_info: /bin/sh: mysql_config: command not found Traceback (most recent call last): File "", line 1, in File "/tmp/pip-install-qne9mqvi/mysqlclient/setup.py", line 16, in metadata, options = get_config() File "/tmp/pip-install-qne9mqvi/mysqlclient/setup_posix.py", line 51, in get_config libs = mysql_config("libs") File "/tmp/pip-install-qne9mqvi/mysqlclient/setup_posix.py", line 29, in mysql_config raise EnvironmentError("%s not found" % (mysqlconfig_path,)) OSError: mysql_config not found

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-qne9mqvi/mysqlclient/

4 respostas

tentei fazer uma instalação flask_mysql antes de instalar o flask_mysqldb, mas apenas a primeira funcionou já a segunda continuou dando falha

(venv) pip3 install flask_mysql

Collecting flask_mysql Using cached https://files.pythonhosted.org/packages/f0/7a/ee1b74a211c3da66383eb07d0221cee6b0c3490e5003b797e66b6eaf9592/Flask_MySQL-1.4.0-py2.py3-none-any.whl Requirement already satisfied: PyMySQL in ./venv/lib/python3.7/site-packages (from flask_mysql) (0.9.3) Requirement already satisfied: Flask in ./venv/lib/python3.7/site-packages (from flask_mysql) (0.12.2) Requirement already satisfied: itsdangerous>=0.21 in ./venv/lib/python3.7/site-packages (from Flask->flask_mysql) (1.1.0) Requirement already satisfied: Jinja2>=2.4 in ./venv/lib/python3.7/site-packages (from Flask->flask_mysql) (2.10) Requirement already satisfied: click>=2.0 in ./venv/lib/python3.7/site-packages (from Flask->flask_mysql) (7.0) Requirement already satisfied: Werkzeug>=0.7 in ./venv/lib/python3.7/site-packages (from Flask->flask_mysql) (0.15.1) Requirement already satisfied: MarkupSafe>=0.23 in ./venv/lib/python3.7/site-packages (from Jinja2>=2.4->Flask->flask_mysql) (1.1.1) Installing collected packages: flask-mysql Successfully installed flask-mysql-1.4.0

instalação do flask_mysqldb

(venv) pip3 install flask_mysqldb==0.2.0

Collecting flask_mysqldb==0.2.0 Using cached https://files.pythonhosted.org/packages/62/e3/955c845efe1aacf30c8e2607470544ede36aa1044f6382c809f13e014104/Flask-MySQLdb-0.2.0.tar.gz Requirement already satisfied: Flask>=0.10 in ./venv/lib/python3.7/site-packages (from flask_mysqldb==0.2.0) (0.12.2) Collecting mysqlclient (from flask_mysqldb==0.2.0) Using cached https://files.pythonhosted.org/packages/f4/f1/3bb6f64ca7a429729413e6556b7ba5976df06019a5245a43d36032f1061e/mysqlclient-1.4.2.post1.tar.gz Complete output from command python setup.py egg_info: /bin/sh: mysql_config: command not found Traceback (most recent call last): File "", line 1, in File "/tmp/pip-install-fa6kyp0k/mysqlclient/setup.py", line 16, in metadata, options = get_config() File "/tmp/pip-install-fa6kyp0k/mysqlclient/setup_posix.py", line 51, in get_config libs = mysql_config("libs") File "/tmp/pip-install-fa6kyp0k/mysqlclient/setup_posix.py", line 29, in mysql_config raise EnvironmentError("%s not found" % (mysqlconfig_path,)) OSError: mysql_config not found

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-fa6kyp0k/mysqlclient/

Se tentar instalar o mysql-python dá erro?

pip install mysql-python

Também dá erro.

(venv)pip3 install mysql-python Collecting mysql-python Using cached https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip Complete output from command python setup.py egg_info: Traceback (most recent call last): File "", line 1, in File "/tmp/pip-install-lvzi05oq/mysql-python/setup.py", line 13, in from setup_posix import get_config File "/tmp/pip-install-lvzi05oq/mysql-python/setup_posix.py", line 2, in from ConfigParser import SafeConfigParser ModuleNotFoundError: No module named 'ConfigParser'

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-lvzi05oq/mysql-python/

solução!

Alternativa para o problema em:

https://cursos.alura.com.br/forum/topico-ha-uma-outra-alternativa-sem-ser-o-flask_mysqldb-81340