0

I'm using python 3.10. I want to use MySQL database, but whenever I am trying to import the module it throws the error. I am using MAC OS. There are certain file for windows to import but I wasn't able to find solution for Mac OS.

ImportError: No module named flask_mysqldb

from flask_mysqldb import MySQL
James Z
  • 12,209
  • 10
  • 24
  • 44

1 Answers1

0

do you have flask_mysqldb installed on your work environment? if not

  • Create a virtual environment for your script using the command

  • pip3 install virtualenv

  • virtualenv "desired name for virtual environment"

  1. install flask_mysqldb according to the documentation
  • pip install flask-mysqldb.

  • from flask import Flask

  • from flask_mysqldb import MySQL

Reference: https://flask-mysqldb.readthedocs.io/en/latest/

Muhammadyk
  • 121
  • 1
  • 7