StackOverflow 中有类似的问题,但在 2020 年 2 月的 Mac OS Catalina 中,没有一个对我完全适用。我什至没有尝试涉及可能会支付的大量权限更改、链接或低级解决方法的问题未来。
I finally ended up with a similar but safer solution:
brew uninstall openssl
Homebrew will probably warn you about other packages that depend on it, specially mysql
, and maybe python@3.8
or others. Don't force it , just uninstall all of them:
brew uninstall mysql
brew uninstall python@3.8
brew uninstall ... # everything you have as dependencies
brew uninstall openssl
Now just reinstall mysql
and openssl
will be reinstalled too automatically, this time without errors:
brew install mysql
Now everything will work again:
python
import MySQLdb
Edit
In case it is still failing, take a look if it is the cache of pip
the one keeping the problem:
brew info openssl # to copy your LDFLAGS path of the lib
pip uninstall mysqlclient
LDFLAGS="-L/usr/local/opt/openssl@1.1/lib" pip install --no-cache-dir mysqlclient
python
import MySQLdb
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.