You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

求助:运行程序时出现ModuleNotFoundError: No module named 'cryptography'错误怎么办?

解决ModuleNotFoundError: No module named 'cryptography'的方案
  • 基础安装操作
    直接用包管理器安装模块:

    • 常规pip安装:pip install cryptography
    • 系统存在多Python版本时,指定Python3:pip3 install cryptography
    • 用conda环境的话:conda install cryptography
  • 虚拟环境注意事项
    如果项目用了虚拟环境,必须先激活对应环境再安装:

    • Windows系统:venv\Scripts\activate
    • Linux/macOS系统:source venv/bin/activate
      激活后再执行上面的安装命令。
  • 处理安装失败的编译问题
    要是安装时出现编译错误,先装系统依赖:

    • Debian/Ubuntu:sudo apt-get install build-essential libssl-dev libffi-dev python3-dev
    • RHEL/CentOS:sudo yum install gcc openssl-devel libffi-devel python3-devel
    • macOS:先装Xcode命令行工具xcode-select --install,再用brew装依赖brew install openssl@3
  • 验证安装结果
    安装完后,打开Python控制台,输入import cryptography,没报错就说明安装成功。

内容的提问来源于stack exchange,提问作者John Paul Blauro

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.31 11:40:58