在 Debian 系统上查看 Rust 版本,常用方法如下:
rustc --version
或简写:
rustc -V
输出示例:
rustc 1.79.0 (129f3b996 2024-06-10)
cargo --version
或:
cargo -V
说明 Rust 可能未安装,或不在 PATH 中:
rustup show
可查看当前工具链及版本。
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
或使用 Debian 仓库(版本可能较旧):
sudo apt update
sudo apt install rustc cargo
rustup toolchain list
如果你是在容器、CI 或特定用户环境下,请注意是否使用了 source $HOME/.cargo/env 来加载 Rust 环境。