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安装即可。

相关推荐
坤坤子吖12 分钟前
Python基础语法学习:条件、循环与程序控制
开发语言·笔记·python·学习
吠品17 分钟前
volatile到底在拦什么:SysTick->VAL读的哪格
java·服务器·开发语言
鶴哥只手遮天20 分钟前
深入理解OpenSceneGraph(五):插件生态与最佳实践
后端
狼与自由38 分钟前
python打包
开发语言·python
进击的雷神38 分钟前
OpenClaw 太重、启动太慢?我试了试这个 Rust 重写的轻量版 AI 助手网关
开发语言·人工智能·rust·zeroclaw
辛苦才能39 分钟前
C++ 红黑树(上):五条规则背后的近似平衡与插入的三类情况
开发语言·c++
Είναι η κοπέλα44 分钟前
Python 虚拟环境:venv、conda 与 Python 版本选择全解
开发语言·python·conda
程序员老陆1 小时前
嵌入式 Qt:QWidgets 还是 QML / Qt Quick?
开发语言·qt
.道阻且长.1 小时前
C++11 :新的类功能,lambda,包装器
开发语言·c++·后端
言乐61 小时前
JavaScript概括前端原理
开发语言·前端·javascript·python·ecmascript