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

安装Python cryptography时因screamingsnakecase模块失败求助

安装cryptography库时Inflector编译失败的解决方案

问题描述

在Debian 11的全新virtualenv中安装HomeAssistant所需的Python cryptography库,执行pip install cryptography时出现编译错误,Inflector v0.11.4找不到screamingsnakecase模块,相关导入无法解析。

错误详情

Compiling Inflector v0.11.4

Running `rustc --crate-name inflector /home/ha/.cargo/registry/src/github.com-1285ae84e5963aae/Inflector-0.11.4/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off -C overflow-checks=on -C metadata=24d92325aeb54f99 -C extra-filename=-24d92325aeb54f99 --out-dir /home/ha/pip_tmp/pip-install-rlon2cnz/cryptography_70234a9f3a1d4c4e96ab4ab0fdb076c9/src/rust/target/release/deps -L dependency=/home/ha/pip_tmp/pip-install-rlon2cnz/cryptography_70234a9f3a1d4c4e96ab4ab0fdb076c9/src/rust/target/release/deps --cap-lints allow`
  error[E0583]: file not found for module `screamingsnakecase`
    --> /home/ha/.cargo/registry/src/github.com-1285ae84e5963aae/Inflector-0.11.4/src/cases/mod.rs:22:1
     |
  22 | pub mod screamingsnakecase;
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = help: to create the module `screamingsnakecase`, create file "/home/ha/.cargo/registry/src/github.com-1285ae84e5963aae/Inflector-0.11.4/src/cases/screamingsnakecase.rs" or "/home/ha/.cargo/registry/src/github.com-1285ae84e5963aae/Inflector-0.11.4/src/cases/screamingsnakecase/mod.rs"

  error[E0432]: unresolved import `cases::screamingsnakecase::to_screaming_snake_case`
    --> /home/ha/.cargo/registry/src/github.com-1285ae84e5963aae/Inflector-0.11.4/src/lib.rs:62:5
     |
  62 | use cases::screamingsnakecase::to_screaming_snake_case;
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `to_screaming_snake_case` in `cases::screamingsnakecase`

  error[E0432]: unresolved import `cases::screamingsnakecase::is_screaming_snake_case`
    --> /home/ha/.cargo/registry/src/github.com-1285ae84e5963aae/Inflector-0.11.4/src/lib.rs:63:5
     |
  63 | use cases::screamingsnakecase::is_screaming_snake_case;
     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `is_screaming_snake_case` in `cases::screamingsnakecase`

  Some errors have detailed explanations: E0432, E0583.

环境信息

Python: 3.9.2
      platform: Linux-5.10.0-20-rt-armmp-armv7l-with-glibc2.31
      pip: n/a
      setuptools: 66.0.0
      setuptools_rust: 1.5.2
      rustc: n/a

解决方案

  • 清理Cargo缓存:执行cargo clean,重新运行pip install cryptography,缓存的Inflector包可能损坏,缺少必要的模块文件。
  • 指定cryptography版本:安装旧版本避免依赖有问题的Inflector,执行pip install cryptography==38.0.4。
  • 更新setuptools-rust:执行pip install --upgrade setuptools-rust,确保Rust构建工具版本兼容,解决模块解析问题。
  • 手动删除损坏的Inflector包:删除.cargo/registry/src/github.com-*/Inflector-0.11.4目录,重新运行安装命令,让Cargo重新下载完整的包文件。

内容的提问来源于stack exchange,提问作者Mike

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.04 07:25:31