Getting "library Not Loaded: Libssl.1.0.0.dylib", "reason: Image Not Found" With Flask_mysqldb
Solution 1:
Solved the Issue
After doing some more search I found a fix that worked for me:
Step 1: Install openssl using brew
brew install openssl
Step 2: Copy libssl.1.0.0.dylib and libcrypto.1.0.0.dylib
cd /usr/local/Cellar/openssl/1.0.1f/lib
sudo cp libssl.1.0.0.dylib libcrypto.1.0.0.dylib /usr/lib/
Note the folder name (1.0.1f). There will be change in that depending on your openssl version
Step 3: Remove the existing links
sudo rm libssl.dylib libcrypto.dylib
sudo ln -s libssl.1.0.0.dylib libssl.dylib
sudo ln -s libcrypto.1.0.0.dylib libcrypto.dylib
That's it.
Solution 2:
Following worked for me with mysql Ver 14.14 Distrib 5.7.23, for osx10.14 (x86_64) & Django 2.2.3.
- Install version 1.1
brew install openssl@1.1
- Copy required library to /usr/lib location. Refer to article at this url if you have trouble copying to /usr/lib location. System Integrity Change
cd /usr/local/Cellar/openssl@1.1/1.1.1c/lib
sudo cp libssl.1.1.dylib libcrypto.1.1.dylib /usr/lib/
- Remove and update link
sudo rm libssl.dylib libcrypto.dylib
sudo ln -s libcrypto.1.1.dylib libcrypto.dylib
sudo ln -s libssl.1.1.dylib libssl.dylib
Solution 3:
Earlier I was getting the following error.
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/osgeo/_gdal.cpython-37m-darwin.so, 2): Library not loaded: /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylibReferencedfrom: /usr/local/opt/gdal/lib/libgdal.20.dylibReason: image not found
for the following import
import gdal
Just create the directory in the desired location
My installation was here...
/usr/local/Cellar/openssl/1.0.2s/
I created a directory at their desired location. openssl directory was not there, I mkdir ed it.
/usr/local/opt/openssl/
Then copied the folder as required. Now
import gdal
works.
Solution 4:
My approach to this problem was this:
Instead of:
from flask_mysqldb importMySQL
I used:
from flaskext.mysqlimportMySQL
So this means that I pip install flask-mysql
instead of pip install flask-mysqldb
.
Note: if you want to obtain a cursor, with this lib you can do cursor = mysql.get_db().cursor()
Solution 5:
In case of Mac, in the ~/.bash_profile
where you are updating the openssl path. Escape the openssl@1.1
as openssl\@1.1
.
export PATH="/usr/local/opt/openssl\@1.1/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/openssl\@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl\@1.1/include"
Post a Comment for "Getting "library Not Loaded: Libssl.1.0.0.dylib", "reason: Image Not Found" With Flask_mysqldb"