#Mac install mysql python install#
Once I had the appropriate intel mysql client libs installed (via x86 homebrew), all I had to do was this (of course replace /.homebrew-x86, etc as needed with your -lmysqlclient" arch -x86_64 pip install -I -vvv mysqlclientįor more detail see: PyMySQL/mysqlclient#496 You can also see what's happening by doing a more verbose pip install ( pip install -I -vvv mysqlclient). You can control both of those (by setting arch flag and appropriate shell variables), so it is best to do so.
#Mac install mysql python code#
Per above, the mysql executable (which is itself a symlink) doesn't matter- what matters is what arch your pip install is targeting and what libs it is linking to when it builds the c code for MySQLdb. I can't tell from your comment exactly how you installed what and where. but you can hack it since it is all in python. For django, though, it isn't quite close enough. In many cases, the API for that module is close enough to MySQLdb. However it will be much less performant solution- but you can almost certainly get it to work. That said, you could install a pure-python library (with no c-code) and avoid this issue entirely. Since the python installed c-code must be intel (to work with your intel python 3.7) it must talk to c-code that is all intel. In this case, the python module is calling some mysql client libraries. If you were "talking" to the executable, it would matter what arch it was compiled for, so long as worked on your machine. That other c code is a dylib and not an executable. The issue here is that you have some c-code (installed when pip installs the mysql client module) that directly calls other c code. The arch of the mysql executable isn't the issue.
First some general comments that I hope are helpful. I am able to workaround by using pymysql instead, but this is not an acceptable solution. Version_info, _mysql.version_info, _mysql._file_
In /Users/davidv/Projects/venv/order-book/lib/python3.9/site-packages/MySQLdb/_ĭuring handling of the above exception, another exception occurred:įile “/Users/davidv/Projects/venv/order-book/lib/python3.9/site-packages/MySQLdb/_init_.py”, line 24, in Referenced from: /Users/davidv/Projects/venv/order-book/lib/python3.9/site-packages/MySQLdb/_ ImportError: dlopen(/Users/davidv/Projects/venv/order-book/lib/python3.9/site-packages/MySQLdb/_, 2): Symbol not found: _mysql_affected_rows