错误库未加载:/usr/local/opt/mysql-client/lib/libssl.1.1



我正在运行我的应用程序并得到这个错误-似乎它与一些mysql-client包有关

Uncaught exception!
Traceback (most recent call last):
File "/Users/myname/my-app/some/path/sqlalchemy_db_profiling.py", line 10, in <module>
from MySQLdb.converters import conversions, escape
File "/Users/myname/my-app/venv/lib/python3.7/site-packages/MySQLdb/__init__.py", line 18, in <module>
from . import _mysql
ImportError: dlopen(/Users/myname/my-app/venv/lib/python3.7/site-packages/MySQLdb/_mysql.cpython-37m-darwin.so, 2): 
Library not loaded: /usr/local/opt/mysql-client/lib/libssl.1.1.dylib
Referenced from: /Users/myname/my-app/venv/lib/python3.7/site-packages/MySQLdb/_mysql.cpython-37m-darwin.so
Reason: image not found

这些是我对requirements.txt的依赖:

Flask==1.1.2
Flask-Login==0.5.0
Flask-Security==3.0.0
Flask-SQLAlchemy==2.4.4
gevent==1.5.0
SQLAlchemy==1.3.20
mysqlclient==1.4.6
PyMySQL==0.10.1
Flask-Compress==1.8.0
Flask-HTTPAuth==3.3.0

:

  • OS: macOS 11.4 (Big Sur)
  • Python: pyenv Python 3.7.10
  • Connector/C: Homebrew mysql-client 8.0.29
  • Openssl: Homebrew openssl@1.1

注意:我的程序跑好直到今天。今天早上我运行了brew update && brew upgrade,从那以后我得到了以上的错误。

当我检查/usr/local/opt/mysql-client/lib下的内容时,我得到的是:

> ls /usr/local/opt/mysql-client/lib
libmysqlclient.21.dylib libmysqlclient.a        libmysqlclient.dylib    pkgconfig

解决方案:https://github.com/PyMySQL/mysqlclient/issues/546

  • 创建clean venv
  • 清除pip缓存。(轮缓存可能包含旧的二进制链接旧的客户端库)。
  • 按照brew info mysql-client说的做例如export PKG_CONFIG_PATH=/usr/local/opt/mysql-client/lib/pkgconfig">
  • 再次安装。

相关内容

  • 没有找到相关文章

最新更新