Rust
使用 rustup 安装和管理 Rust 工具链。
安装
macOS
bash
xcode-select --install
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shUbuntu
bash
sudo apt update
sudo apt install -y curl build-essential
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shWindows
安装 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