mojave python 3.7 libmysqlclient.21.dylib问题

7dl7o3gd  于 2021-06-18  发布在  Mysql
关注(0)|答案(1)|浏览(380)

mojave python 3.7 libmysqlclient.21.dylib问题

File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/MySQLdb/__init__.py", line 18, in <module>
import _mysql
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/_mysql.cpython-37m-darwin.so, 2): Library not loaded: @rpath/libmysqlclient.21.dylib
Referenced from: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/_mysql.cpython-37m-darwin.so
Reason: image not found
wz8daaqr

wz8daaqr1#

我的Python3.6项目是查找libmysqlclient.21.dylib。
我安装了 brew install mysql-client . 安装了mysql客户端8.0。它有libmysqlclient.21.dylib。我想用的地方mysql@5.6.
所以我将libmysqlclient.21.dylib从/usr/local/cellar/mysql client/8.0.19/lib复制到/usr/local/lib/ sudo ln -s /usr/local/Cellar/mysql-client/8.0.19/lib/libmysqlclient.21.dylib /usr/local/lib/libmysqlclient.21.dylib 所以这是一个python,mysql,mysqlclient版本不匹配的问题。
mysql@5.6 有libmysqlclient.18mysql@5.7 有libmysqlclient.20
在mac-osx-catalina中遵循上述方法。

相关问题