找不到Rust编译器来安装变压器

问题描述 投票:0回答:2

我不知道如何修复此错误(对于 Windows 上的 pip install 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 时它也不起作用。

windows rust
2个回答
5
投票

安装 Transformer 之前需要先安装 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

0
投票

我也遇到了按照上述建议安装 rustup 后仍然存在的问题。使用[使用拥抱变压器进行情感分析][1]我发现以下 pip 命令来安装变压器:

pip install transformers==4.6.1

设置变压器版本以安装相关安装,它已完成,没有任何进一步的问题。 我希望这可以帮助其他人节省安装时间...... [1]:https://python.plainenglish.io/sentiment-analysis-in-python-with-3-lines-of-code-9382a649c23d

© www.soinside.com 2019 - 2024. All rights reserved.