from cryptography.hazmat.bindings._rust import openssl as rust_openssl
ImportError: DLL load failed: 找不到指定的程序。
核心问题出在 cryptography(加密库)上:
cryptography在较新的版本中(比如你之前提示的45.0.7),底层是用 Rust 语言 编写并编译成二进制 DLL 文件的。- 较新版本的
cryptography的二进制 DLL 文件在编译时,需要服务器系统具备较新的 C++ 运行库(VC++ Redistributable)。 - Windows 服务器(尤其是未定期更新的 Windows Server 2012/2016/2019)往往缺少这些底层运行库,或者你的 Python 3.7 版本太老,与最新版的二进制库发生了冲突。
解决方法,安装老版本
pip uninstall -y cryptography cffi
pip install cryptography==36.0.2