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

相关推荐
Fox爱分享17 分钟前
都问程序员双十一买什么,我的答案一定是这块专业编程显示器
后端·程序员·ai编程
CCblandy30 分钟前
缓存淘汰实测:一次全表扫描把 LRU 命中率从 46% 打到 38%,W-TinyLFU 守住 50% 却贵 11 倍
后端·python·缓存·性能优化·架构
BuHuaX35 分钟前
Lua 与 ToLua:运行机制及热更新原理
开发语言·unity·junit·c#·lua
xys_67837 分钟前
深挖C++:C++入门基础
开发语言·c++
武子康40 分钟前
DOA 100%、GSC 改善 12 dB,ESP32-P4 远场拾音就能用了吗?
人工智能·后端·agent
RobinDevNotes1 小时前
Memvid 把 Agent 长期记忆塞进一个文件
人工智能·rust·openresty
幻境如梦丶皆为虚1 小时前
从零写一个 DSH 插件:在左侧菜单栏加一个「测试」
开发语言·javascript·ecmascript
愚农搬码1 小时前
企业为什么需要表单引擎,而不是继续手写 Vue 表单?
后端
孟陬2 小时前
技术周刊#158:ChatGPT 智能 UI 底层原理、个人智能体协议正式发布、一条 POST 请求即可锁死 Next.js 服务
人工智能·后端·全栈