ImportError: DLL load failed while importing _rust: 找不到指定的模块。
安装qwen-agent 过程需要安装 cryptography
报错 :
177 WARNING: Failed to collect submodules for ‘cryptography.hazmat.backends.openssl’ because importing ‘cryptography.hazmat.backends.openssl’ raised: ImportError: DLL load failed while importing _rust: 找不到指定的模块。
14542 WARNING: hook-cryptography: failed to determine whether cryptography is using OpenSSL >= 3.0.0
系统:
os : win11
cpu : snapdragon 8cx gen3 , arm64
python :3.12.7
cryptography 报错
依赖 OpenSSL >= 3.0.0
我这里下载 openssl-3.3.2 编译成 win11 arm64 ,安装到路径C:\Programs\OpenSSL-3.3.2
配置环境变量
OPENSSL_DIR=C:\Programs\OpenSSL-3.3.2
LIB=C:\Programs\OpenSSL-3.3.2\lib
INCLUDE=C:\Programs\OpenSSL-3.3.2\include
Path=C:\Programs\OpenSSL-3.3.2\bin
然后清理之前 pip 编译的缓存:
PS C:\Users\966> pip cache info
(pip v23.3+): c:\users\966\appdata\local\pip\cachePS C:\Users\966> rm c:\users\966\appdata\local\pip\cache
重新安装:
pip install cryptography==42
查看效果
(venv) PS C:\workspace> pip list |findstr crypt
cryptography 42.0.0
(venv) PS C:\workspace> pip list | findstr qwen
qwen-agent 0.0.10