EDIT: Problem resolved. I was able to finally figure out the problem with some help from another student in the Udemy class along with the answer from Isaac_R here. I had to edit my .bash_profile with the following two lines of code and I am able to install MySQLdb and it is working as intended now. Here are the two lines I added to my .bash_profile
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/ export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH
EDIT #2: I just started another mysql project in a new file, I had to run pip3 install mysqlclient before I could install mysqldb, just a heads up to someone who may have this issue like I did.
I am totally new to coding so please excuse my potential ignorance, I am trying my best to learn something new and it was going well until I ran into this issue that I am unable to get passed. I am on a Mac with 10.15.4 in python3.8.2 trying to create a MySQL database in order to use in a blog I am attempting to build. I have installed the mysql client along with pip3 install flask-mysqldb. I get successful conformation of the install, here is where my problems start. In Atom I am using the command from ''flask_mysqldb import MySQL'' to which I receive the error of the following
Traceback (most recent call last):
File "app.py", line 3, in <module>
from flask_mysqldb import MySQL
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/flask_mysqldb/__init__.py", line 1,
in <module>
import MySQLdb
File "IndentationError: unexpected indent
(venv) tylernelson@Tylers-MacBook-Air My Project % python3 app.py
Traceback (most recent call last):
File "app.py", line 3, in <module>
from flask_mysqldb import MySQL
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/flask_mysqldb/__init__.py", line 1,
in <module>
import MySQLdb
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/MySQLdb/__init__.py", line 18, in <
module>
from . import _mysql
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/MySQLdb/_mysql.cpython-
38-darwin.so, 2): Library not loaded: @rpath/libmysqlclient.21.dylib
Referenced from: /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/MySQLdb/_mysql.cpython-3
8-darwin.so
Reason: image not found"
I am able to post my entire (all be it super short) code file also if that will help resolve the problem. Thank you so much for your ideas and help!