0

I have a flask application that uses flask_mysqldb to connect with database. I had imported MySQLdb and flask_mysqldb packages to use. Some update today morning screwed this. I had to replace MySQLdb with pymysql because it is not compatible with Python 3.x as per some threads here. The code is still not working because flask_mysqldb uses MySQLdb internally. I get the following error:

 from flask_mysqldb import MySQL
  File "/opt/homebrew/lib/python3.11/site-packages/flask_mysqldb/__init__.py", line 1, in <module>
    import MySQLdb
ModuleNotFoundError: No module named 'MySQLdb'

Any help on how I can resolve this is most welcome. I have been googling and going through different threads here and not getting anywhere.

3
  • Did you try installing it? Commented Feb 13, 2024 at 10:35
  • ok. i think the issue might be with mysqlclient. that wont install. i get this error: src/MySQLdb/_mysql.c:29:10: fatal error: 'mysql.h' file not found #include "mysql.h" ^~~~~~~~~ 1 error generated. error: command '/usr/bin/clang' failed with exit code 1 Commented Feb 13, 2024 at 10:46
  • This issue is a very common question - you should be able to find a duplicate. Commented Feb 13, 2024 at 11:12

0

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.