Rust学习-基础环境配置
在学习Rust 语言之前,先配置号本地Rust 语言环境
官网地址:https://rust-lang.org/zh-CN/
windows下载64位:
windows 根据cpu 下载intel 或者arm 的。我这里使用intel。
下载后直接安装:
首先会安装 Vistual Stall C++ 相关扩展。
会自动再次安装 rust 相关软件
info: profile set to default
info: default host triple is x86_64-pc-windows-msvc
info: syncing channel updates for stable-x86_64-pc-windows-msvc
info: latest update on 2026-07-16 for version 1.97.1 (8bab26f4f 2026-07-14)
info: downloading 6 components
cargo downloading [# ] 9.71 MiB (49.37 KiB/s, ETA: 3m)
clippy downloading [## ] 4.04 MiB (39.19 KiB/s, ETA: 2m)
ubuntu:安装,使用中科大最稳定
# 安装命令
export RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static
export RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup
curl --proto '=https' --tlsv1.2 -sSf https://mirrors.ustc.edu.cn/rust-static/rustup/rustup-init.sh | sh
# 命令结束,以下是提示
You can uninstall at any time with rustup self uninstall and
these changes will be reverted.
Current installation options:
default host triple: x86_64-unknown-linux-gnu
default toolchain: stable (default)
profile: default
modify PATH variable: yes
1) Proceed with standard installation (default - just press enter)
2) Customize installation
3) Cancel installation
# 我默认选择 1 然后按回车。
1
# 等到,表示安装成功
Rust is installed now. Great!
To get started you may need to restart your current shell.
This would reload your PATH environment variable to include
Cargo's bin directory ($HOME/.cargo/bin).
To configure your current shell, you need to source
the corresponding env file under $HOME/.cargo.
This is usually done by running one of the following (note the leading DOT):
. "$HOME/.cargo/env" # For sh/bash/zsh/ash/dash/pdksh 我用的zsh
source "$HOME/.cargo/env.fish" # For fish
source "~/.cargo/env.nu" # For nushell
source "$HOME/.cargo/env.tcsh" # For tcsh
. "$HOME/.cargo/env.ps1" # For pwsh
source "$HOME/.cargo/env.xsh" # For xonsh
#我用zsh 运行 ,启动环境。
. "$HOME/.cargo/env"
rustc --version
rustc 1.97.1 (8bab26f4f 2026-07-14)