请问有人可以帮助我吗?
我正在尝试在我的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