I have looked all over and tried everything to resolve this issue for a day or two, but haven’t had any luck.
I am using flask and sql for the first time(macOS), I have everything installed. But I am guessing that it is either installed incorrectly, or in the wrong folder.
I installed sql directly from their website, I then followed this advice here…
$ open -t .bash_profile
I know that it does work because I am able to go into the database in my terminal. my Flask app does work (it runs before adding all of the sql code), but the only thing I am having trouble with is running my program after importing(from flask_mysqldb import MySQL).
This is the tutorial I am following as well, https://www.youtube.com/watch?v=6L3HNyXEais
my error is here…
Error: While importing “app”, an ImportError was raised:
Traceback (most recent call last):
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask/cli.py”, line 235, in locate_app
File “/Users/jonathanmast/flask_prac/app.py”, line 2, in
from flask_mysqldb import MySQL
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/flask_mysqldb/init.py”, line 1, in
File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/MySQLdb/init.py”, line 18, in
from . import _mysql
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/MySQLdb/_mysql.cpython-37m-darwin.so, 2): Library not loaded: @rpath/libmysqlclient.18.dylib
Referenced from: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/MySQLdb/_mysql.cpython-37m-darwin.so