使用“ /usr/lib/libcrypto.dylib”在MacOS 10.15 Beta(19A582a)上使Python崩溃

Fai*_*zer 25 python libcrypto oh-my-zsh macos-catalina

我使用新的macOS Catalina运行了Django项目,并且运行良好。
我安装了oh_my_zsh,然后尝试运行它因以下错误而崩溃的同一项目。我卸载了oh_my_zsh并再次尝试,但没有成功。

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.

Run Code Online (Sandbox Code Playgroud)

Ton*_*ark 63

对我来说,重新安装 Python 的密码学包就足够了。

pip uninstall cryptography
pip install cryptography
Run Code Online (Sandbox Code Playgroud)

  • 这对我有用。就我而言,将 virtualenv 更新到最新版本后,ansible 未执行。 (2认同)
  • 太棒了,它可以在 MacOS 10.15.4 上运行。非常感谢! (2认同)

bix*_*xel 35

我只是遇到了同样的问题,手动链接周围的东西有点不舒服。

我能够通过简单地解决问题

  1. 通过自制软件安装openssl:
    brew install openssl
    
    Run Code Online (Sandbox Code Playgroud)
  2. 通过DYLD_LIBRARY_PATH从openssl指向动态库:
    export DYLD_LIBRARY_PATH=/usr/local/opt/openssl/lib:$DYLD_LIBRARY_PATH
    
    Run Code Online (Sandbox Code Playgroud)

我刚刚将该行添加到我的.zshrc中。

编辑:根据这个问题,的使用DYLD_FALLBACK_LIBRARY_PATH可能比更好DYLD_LIBRARY_PATH

  • 赞成不搞乱系统 (11认同)
  • 每个人都应该在这之前尝试下面的@tonyStarks 答案,它可能只是一个简单的卸载和重新安装给你 (4认同)
  • 可以确认“export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/opt/openssl/lib”按照您的描述工作。谢谢你的提示! (2认同)

hon*_*boy 30

警告:我不是安全专家,该解决方案与加密库混淆!

我认为您的问题不是源于zsh或oh-my-zsh。我的最佳猜测:MacOS 10.15上安装的某些加密库与Homebrew的python3安装不兼容。

这是为我解决问题的原因

# Install openssl via homebrew.
# Note: According to homebrew, "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."
brew install openssl
# Symlink those versions into /usr/local/lib, which gets Python to dynamically
# link against those instead of the version in /usr/lib/.
# Got the idea from https://forums.developer.apple.com/thread/119429
cd /usr/local/lib
sudo ln -s /usr/local/Cellar/openssl/1.0.2t/lib/libssl.1.0.0.dylib libssl.dylib
sudo ln -s /usr/local/Cellar/openssl/1.0.2t/lib/libcrypto.1.0.0.dylib libcrypto.dylib
Run Code Online (Sandbox Code Playgroud)

我的情况:

  • 最近升级到MacOS 10.15
  • 我使用通过自制软件安装的python / pip: brew install python
  • pip3 失败了 SIGABRT

系统错误报告的标题:

Process:               Python [52429]
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:        zsh [43309]
Responsible:           iTerm2 [2316]
User ID:               501

Date/Time:             2019-10-09 09:52:18.148 -0700
OS Version:            Mac OS X 10.15 (19A583)
Report Version:        12
Bridge OS Version:     4.0 (17P572)
Anonymous UUID:        

Sleep/Wake UUID:       

Time Awake Since Boot: 9900 seconds
Time Since Wake:       7300 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.
Run Code Online (Sandbox Code Playgroud)


Jur*_*vec 8

Apple Dev线程中的r.xuanInvalid dylib load. Clients should not load the unversioned libcrypto dylib as it does not have a stable ABI. 通过将libssl.dyliblibcrypto.dylib链接替换为/usr/local/libHomebrew安装的lib的链接,从而确定了该错误的解决方法的步骤 openssl

这些步骤是:

获取新的库

1) brew update && brew upgrade && brew install openssl

2) cd /usr/local/Cellar/openssl/1.0.2t/lib

3) sudo cp libssl.1.0.0.dylib libcrypto.1.0.0.dylib /usr/local/lib/

备份旧的

4) cd /usr/local/lib

5) mv libssl.dylib libssl_bak.dylib

6) mv libcrypto.dylib libcrypto_bak.dylib

建立新连结

7) sudo ln -s libssl.1.0.0.dylib libssl.dylib

8) sudo ln -s libcrypto.1.0.0.dylib libcrypto.dylib


And*_*scu 7

我更喜欢@ bixel,@ Juro Oravec和@honkaboy的组合答案:

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
Run Code Online (Sandbox Code Playgroud)

这样,至少在理论上,当更新openssl时,dylib将始终指向最新版本。/usr/local/opt/openssl实际上是一个链接/usr/local/Cellar/openssl/Cellar/openssl/1.0.2t(brew安装的openssl版本)。

这个问题发生的原因实际上是由brew解释的:

openssl是仅桶式的,这意味着它没有符号链接到/ usr / local,因为Apple已弃用OpenSSL而不是使用其自己的TLS和加密库。

尝试运行brew link openssl

警告:拒绝链接macOS提供的软件:openssl如果需要首先在运行PATH中运行openssl:echo'export PATH =“ / usr / local / opt / openssl / bin:$ PATH”'>>〜/ .bash_profile

为了使编译器能够找到openssl,您可能需要设置:export LDFLAGS =“-L / usr / local / opt / openssl / lib” export CPPFLAGS =“-I / usr / local / opt / openssl / include”

为了使pkg-config查找openssl,您可能需要设置:export PKG_CONFIG_PATH =“ / usr / local / opt / openssl / lib / pkgconfig”

因此,基本上,您需要手动链接它们。


mem*_*lyk 5

我看到了类似的问题ansible。罪魁祸首是asn1crypto,问题已经解决

我的解决方案是手动删除它并使用以下命令重新安装它pip

  1. rm -r /usr/local/lib/python2.7/site-packages/asn1crypto*. 这允许pip工作没有问题。
  2. pip install asn1crypto,其中安装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
Run Code Online (Sandbox Code Playgroud)

注意:您可以asn1crypto通过python在详细模式下运行来检查是否是罪魁祸首,例如python -v $(which ansible). 在我的情况下,它在执行一些asn1crypto相关导入时崩溃了:

# /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)
Run Code Online (Sandbox Code Playgroud)

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