无法找到Rust编译器以安装transformers。

3
我不知道如何解决这个错误(在Windows上使用pip安装transformer时出现的错误):错误:找不到Rust编译器。
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 tokenizers
Failed to build tokenizers
ERROR: Could not build wheels for tokenizers, which is required to install pyproject.toml-based projects

我也尝试了这个:

git clone https://github.com/huggingface/transformers.git 
cd transformers
pip install -e .

当我安装 Rust 时,它也无法工作。


那么会发生什么呢?您是如何安装 Rust 的?您是否检查过 Rust 是否正确地设置在您的路径中(例如通过运行 rustc --version 命令)? - Jmb
我也遇到了同样的问题,你找到解决方案了吗? - Myzel394
当我安装Rasa时,我遇到了同样的问题。我不得不安装SentencePiece,然后错误就没有再出现了。不幸的是,我无法重现你的错误。 - 3r1c
1个回答

3

在安装 transformers 之前,您需要先安装 Rust。

安装 Rust 的标准方式(来自Rust 文档)如下:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

在Windows上,您可以使用替代方法


有时在安装脚本中使用默认答案是很有用的。
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y

如果你的软件包管理器中有 rustup,那么这可能比从互联网下载脚本运行更可取。虽然我不建议使用软件包管理器安装 rustccargo,因为它们很可能非常过时。 - Filipe Rodrigues

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接