Mac M1 未加载 Openssl 库(未加载库:/usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib)
Posted
技术标签:
【中文标题】Mac M1 未加载 Openssl 库(未加载库:/usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib)【英文标题】:Openssl library is not loaded at Mac M1 (Library not loaded: /usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib) 【发布时间】:2021-07-21 13:00:01 【问题描述】:有人可以帮帮我吗?
我正在尝试在我的 Mac 上使用 PyTest
在我的 venv
环境中运行 Python 自动化测试,但出现这样的错误:
库未加载:/usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib
我已尝试重新安装 openssl:
brew reinstall openssl@1.1
..........
A CA file has been bootstrapped using certificates from the system keychain. To add additional certificates, place .pem files in /opt/homebrew/etc/openssl@1.1/certs
and run /opt/homebrew/opt/openssl@1.1/bin/c_rehash
openssl@1.1 is keg-only, which means it was not symlinked into /opt/homebrew, because macOS provides LibreSSL.
If you need to have openssl@1.1 first in your PATH, run: echo 'export PATH="/opt/homebrew/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc
For compilers to find openssl@1.1 you may need to set: export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib" export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include"
我按照上面的建议做了:
echo 'export PATH="/opt/homebrew/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include"
echo $PATH
/Users/danylokholodov/Documents/my-project/Core_Platform/Code/my-project-qa-framework/venv/bin:/opt/homebrew/opt/openssl@1.1/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Library/Frameworks/Python.framework/Versions/3.9/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands
which openssl
/opt/homebrew/opt/openssl@1.1/bin/openssl
但在执行测试时仍然出现同样的错误:
../../../venv/lib/python3.9/site-packages/pymssql/__init__.py:3: in <module>
from ._pymssql import *
E ImportError: dlopen(/Users/danylokholodov/Documents/my-project/Core_Platform/Code/my-project-qa-framework/venv/lib/python3.9/site-packages/pymssql/_pymssql.cpython-39-darwin.so, 2): Library not loaded: /usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib
E Referenced from: /Users/danylokholodov/Documents/my-project/Core_Platform/Code/my-project-qa-framework/venv/lib/python3.9/site-packages/pymssql/_pymssql.cpython-39-darwin.so
E Reason: image not found
【问题讨论】:
【参考方案1】:我修复了安装 Anaconda 的问题,然后使用 Conda Environment 和 Python 3.8 创建了一个 ENV(在我的例子中是 python 3.8,因为 3.9 不适用于 Psycopg2)。然后我从 Anaconda->Environments->not installed 下载了 Pymssql。然后我在pycharm首选项上进入python解释器,我选择了anaconda小标志,然后+,我在ENV上手动安装了pymssql。
【讨论】:
以上是关于Mac M1 未加载 Openssl 库(未加载库:/usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib)的主要内容,如果未能解决你的问题,请参考以下文章
未加载库:/usr/local/opt/openssl/lib/libssl.1.0.0.dylib (LoadError)
Solana 测试验证器 -- dyld:未加载库:/usr/local/opt/openssl@1.1/lib/libssl.1.1.dylib
Mac OpenSSl is not available的解决方法