SQLAlchemy is not connecting with flask app

52 Views Asked by At

When I connect my SQLAlchemy to flask app, it gives me the following error

File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/sqlalchemy/dialects/mysql/mysqldb.py", line 152, in import_dbapi
    return __import__("MySQLdb")
           ^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'MySQLdb'
1

There are 1 best solutions below

0
On

Try running pip install MySQL-python. Here are the docs for it PyPi MySQL Docs. Make sure this package supports your system architecture and that your version of python supports this package.