import MySQLdb
leads to
Traceback (most recent call last):
File \"\", line 1, in
File \"build/bdist
So, from what I can tell, the @rpath tries to resolve to /usr/lib, which can't be written to. I resolved this by crawling through this site. A lot of it is in Chinese, but what I got was the command sudo install_name_tool -change @rpath/libmysqlclient.21.dylib /usr/local/mysql/lib/libmysqlclient.21.dylib /Users/[username]/.pyenv/versions/career/lib/python2.7/site-packages/_mysql.so
I did something similar to what Sam did and was able to make it work.
I simply made a copy of the libmysqlclient.21.dylib
file located in my up-to-date installation of MySQL 8.0.13 which is was in /usr/local/mysql/lib
and moved that copy under the same name to /usr/lib
.
You will need to temporarily disable security integrity protection on your mac however to do this since you won't have or be able to change permissions to anything in /usr/lib
without disabling it. You can do this by booting up into the recovery system, click Utilities on the menu at the top, and open up the terminal and enter csrutil disable
into the terminal. Just remember to turn security integrity protection back on when you're done doing this! The only difference from the above process will be that you run csrutil enable
instead.
You can find out more about how to disable and enable macOS's security integrity protection here.