Python crashing on MacOS 10.15 Beta (19A582a) with

2020-02-16 08:52发布

I ran my Django project with new macOS Catalina and was running fine.
I installed oh_my_zsh then I tried to run the same project it is crashing with the following errors. I uninstalled oh_my_zsh and tried again but it did not worked.

Path:                  /usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python
Identifier:            Python
Version:               3.7.4 (3.7.4)
Code Type:             X86-64 (Native)
Parent Process:        Python [7526]
Responsible:           Terminal [7510]
User ID:               501

Date/Time:             2019-10-07 20:59:20.675 +0530
OS Version:            Mac OS X 10.15 (19A582a)
Report Version:        12
Anonymous UUID:        CB7F20F6-96C0-4F63-9EC5-AFF3E0989687


Time Awake Since Boot: 3000 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

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.

10条回答
别忘想泡老子
2楼-- · 2020-02-16 09:24

I prefer a combination of @bixel, @Juro Oravec & @honkaboy answers:

brew install openssl
cd /usr/local/lib
sudo ln -s /usr/local/opt/openssl/lib/libssl.dylib libssl.dylib
sudo ln -s /usr/local/opt/openssl/lib/libcrypto.dylib libcrypto.dylib

This way, at least in theory, when updating openssl the dylibs will always point to the latest versions. /usr/local/opt/openssl is actually a link to /usr/local/Cellar/openssl/Cellar/openssl/1.0.2t (the version of openssl installed by brew).

The reason the issue happens is actually explained by brew:

openssl is keg-only, which means it was not symlinked into /usr/local, because Apple has deprecated use of OpenSSL in favor of its own TLS and crypto libraries.

Trying to run brew link openssl:

Warning: Refusing to link macOS-provided software: openssl If you need to have openssl first in your PATH run: echo 'export PATH="/usr/local/opt/openssl/bin:$PATH"' >> ~/.bash_profile

For compilers to find openssl you may need to set: export LDFLAGS="-L/usr/local/opt/openssl/lib" export CPPFLAGS="-I/usr/local/opt/openssl/include"

For pkg-config to find openssl you may need to set: export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig"

So, basically you need to link them manually.

查看更多
做个烂人
3楼-- · 2020-02-16 09:25

I was seeing similar problems with ansible. The culprit was asn1crypto, and the problem has been already fixed.

My solution was to manually remove it and reinstall it with pip:

  1. rm -r /usr/local/lib/python2.7/site-packages/asn1crypto*. This allowed pip to work without problems.
  2. pip install asn1crypto, which installed 1.2.0:
  Found existing installation: asn1crypto 0.24.0
    Uninstalling asn1crypto-0.24.0:
      Successfully uninstalled asn1crypto-0.24.0
Successfully installed asn1crypto-1.2.0

NOTE: You can check if asn1crypto is the culprit by running python in verbose mode, e.g. python -v $(which ansible). In my case it crashed while doing some asn1crypto related imports:

# /usr/local/lib/python2.7/site-packages/asn1crypto/_perf/_big_num_ctypes.pyc matches /usr/local/lib/python2.7/site-packages/asn1crypto/_perf/_big_num_ctypes.py
import asn1crypto._perf._big_num_ctypes # precompiled from /usr/local/lib/python2.7/site-packages/asn1crypto/_perf/_big_num_ctypes.pyc
[1]    59247 abort      python -v $(which ansible)

Related: https://github.com/Homebrew/homebrew-core/issues/44996

查看更多
祖国的老花朵
4楼-- · 2020-02-16 09:28

If you're using Kevlar from DevMate, upgrade to 4.3.1, which "Fixed macOS Catalina crash caused by version of libcrypto.dylib".

查看更多
Rolldiameter
5楼-- · 2020-02-16 09:28

Looks like it was a Homebrew issue. I did brew reinstall python3 and it worked.

查看更多
登录 后发表回答