跳到正文

Rust ​

使用 rustup 安装和管理 Rust 工具链。

安装 ​

macOS ​

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

Ubuntu ​

bash
sudo apt update
sudo apt install -y curl build-essential
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Windows ​

安装 Visual Studio Build Tools,勾选「使用 C++ 的桌面开发」。

powershell
winget install --id Rustlang.Rustup --source winget

也可从 rustup.rs 下载安装程序。

验证 ​

安装完成后重新打开终端:

bash
rustc --version
cargo --version

创建并运行项目:

bash
cargo new hello
cd hello
cargo run

基于 MIT 许可发布