mac python 出現 “Abort trap: 6” 問題
0. 現象
python 程序自動退出
- 命令行下顯示
Abort trap: 6
- pycharm 顯示
Process finished with exit code 134 (interrupted by signal 6:SIGABRT)
1. 查看 python 日誌
日誌位置 ~/Library/Logs/DiagnosticReports
,有 .crash
後綴的日誌文件
Application Specific Information:
/usr/lib/libcrypto.dylib
abort() called
Invalid dylib load. Clients should not load the unversioned libcrypto dylib as it does not have a stable ABI.
2. 原因
如日誌所說,libcrypto
和 dylib
是 unversioned
3. 解決辦法
注意下面但位置不一定是 /usr/local/Cellar/openssl/1.0.2t/lib
,比如我的環境就是 /usr/local/Cellar/openssl/1.0.2q/lib
brew update && brew upgrade && brew install openssl
## note: some people report that the dylib files needed in #3 are in the 1.0.2t folder, rather than the lib folder. adjust your path in #2 as needed.
cd /usr/local/Cellar/openssl/1.0.2t/lib
sudo cp libssl.1.0.0.dylib libcrypto.1.0.0.dylib /usr/local/lib/
cd /usr/local/lib
sudo ln -s libssl.1.0.0.dylib libssl.dylib
sudo ln -s libcrypto.1.0.0.dylib libcrypto.dylib
替換後再運行就行了
參考 & 其他解決方案 (可忽略)
- https://github.com/pypa/pip/issues/7254
- https://forums.developer.apple.com/thread/119429
This is related to pyopenssl using old dependencies.
You can fix it by removing the cryptography package, then upgrading cryptography to version 2.8.