error: can‘t find Rust compiler

操作系统 win11

pip install -r requirements.txt

报错如下

复制代码
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/56/fc/a3c13ded7b3057680c8ae95a9b6cc83e63657c38e0005c400a5d018a33a7/pyreadline3-3.4.1-py3-none-any.whl (95 kB)
Building wheels for collected packages: safetensors
  Building wheel for safetensors (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for safetensors (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [25 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-38
      creating build\lib.win-amd64-cpython-38\safetensors
      copying py_src\safetensors\flax.py -> build\lib.win-amd64-cpython-38\safetensors
      copying py_src\safetensors\numpy.py -> build\lib.win-amd64-cpython-38\safetensors
      copying py_src\safetensors\paddle.py -> build\lib.win-amd64-cpython-38\safetensors
      copying py_src\safetensors\tensorflow.py -> build\lib.win-amd64-cpython-38\safetensors
      copying py_src\safetensors\torch.py -> build\lib.win-amd64-cpython-38\safetensors
      copying py_src\safetensors\__init__.py -> build\lib.win-amd64-cpython-38\safetensors
      running build_ext
      running build_rust
      error: can't find Rust compiler

      If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.

      To update pip, run:

          pip install --upgrade pip

      and then retry package installation.

      If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for safetensors
Failed to build safetensors
ERROR: Could not build wheels for safetensors, which is required to install pyproject.toml-based projects

解决方法:

去官网下载安装rustup.rs - The Rust toolchain installer

下载完rustup-init.exe,运行安装,会出现窗口提示需要预先安装vs,按默认安装即可。等一会vs安装成功。

需要再次手动运行rustup-init.exe,这次就是正式安装了, 都按模型走即可。全部结束就安装成功了。

再去执行pip安装即可。

相关推荐
小短腿的代码世界几秒前
从KB到字节:Qt行情数据压缩与传输优化的全链路透视——LZ4、Snappy与自定义二进制协议的极限压榨
开发语言·qt
yzwlord5 分钟前
【无标题】
linux·运维·rust·ssh
十贝10 分钟前
Tailscale 自建 DERP 中继服务器故障排查与修复记录
后端
Arman_15 分钟前
Rust 客户端安全上传下载阿里云 OSS:rusty-cat 预签名 URL 实战
安全·阿里云·rust·oss断点续传
灵机一物16 分钟前
灵机一物AI原生电商小程序、PC端(已上线)-【技术深度解析】Bun 6 天 AI 重写 96 万行代码:从 Zig 迁移 Rust 全流程与行业影响
开发语言·人工智能·rust
Arman_17 分钟前
03 rusty-cat 进阶解析:架构设计、云存储接入、安全模型与长期维护评估
css·安全·rust·文件分片上传·文件分片下载
Nontee17 分钟前
Java 后端面试题目全集
java·开发语言·面试
lsx20240621 分钟前
CSS 选择器
开发语言
用户67570498850232 分钟前
Redis有1亿个Key,如何优雅地找出特定前缀的那10万条?
后端
Chase_______39 分钟前
【Java杂项】0.1 + 0.2 为什么不等于 0.3?IEEE 754 与 BigDecimal 精度避坑
java·开发语言·python