0

I tried to install flask-mysql from pip3 to python3, but it throws exception. Here is log.

Running setup.py (path:/tmp/pip-build-j2hw4zsz/MySQL-python/setup.py) egg_info for package MySQL-python
Traceback (most recent call last):
  File "<string>", line 17, in <module>
  File "/tmp/pip-build-j2hw4zsz/MySQL-python/setup.py", line 13, in <module>
    from setup_posix import get_config
  File "/tmp/pip-build-j2hw4zsz/MySQL-python/setup_posix.py", line 2, in <module>
    from ConfigParser import SafeConfigParser
ImportError: No module named 'ConfigParser'
Complete output from command python setup.py egg_info:
Traceback (most recent call last):

File "<string>", line 17, in <module>

File "/tmp/pip-build-j2hw4zsz/MySQL-python/setup.py", line 13, in <module>

from setup_posix import get_config

File "/tmp/pip-build-j2hw4zsz/MySQL-python/setup_posix.py", line 2, in <module>

from ConfigParser import SafeConfigParser

ImportError: No module named 'ConfigParser'

So, how to install flask-mysql to python3?

P.S. I tried to install both with "pip3 install flask-mysql" and "pip install Flask...whl".

1

1 Answer 1

6

Flask-MySQL uses MySQL-Python, which doesn't support Python 3, and there has been an open issue about it for over a year. Use Flask-MySQLdb instead, which uses MySQLclient.

pip install flask-mysqldb

Or use SQLAlchemy, a much more powerful interface for working with databases.

pip install flask-sqlalchemy mysqlclient
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.