Rust 安装

Rust 安装

Linux

打开终端并输入下面命令:

$ curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh

此工具将安装 Rust 的最新稳定版本

如果安装成功,将出现下面这行:

Rust is installed now. Great!

Windows

Windows 上安装 Rust 需要有 C++ 环境,以下为安装的两种方式:
先使用工具 安装 C++ 环境 Microsoft C++ Build Tools

x86_64-pc-windows-msvc

RUSTUP-INIT 下载系统相对应的 Rust 安装程序,一路默认即可。

x86_64-pc-windows-gnu

使用 RUSTUP-INIT 弹出的窗口,输入配置

Current installation options:

   default host triple: x86_64-pc-windows-msvc
     default toolchain: stable (default)
               profile: default
  modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>2

I'm going to ask you the value of each of these installation options.
You may simply press the Enter key to leave unchanged.

Default host triple? [x86_64-pc-windows-msvc]
x86_64-pc-windows-gnu

Default toolchain? (stable/beta/nightly/none) [stable]
stable

Profile (which tools and data to install)? (minimal/default/complete) [default]
complete

Modify PATH variable? (Y/n)
Y

Current installation options:

   default host triple: x86_64-pc-windows-gnu
     default toolchain: stable
               profile: complete
  modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
> 1

检查是否安装成功

检查是否正确安装了 Rust,可打开终端并输入下面这行,此时能看到最新发布的稳定版本的版本号、提交哈希值和提交日期:

# rustc -V
rustc 1.60.0 (7737e0b5c 2022-04-04)
# cargo -V
cargo 1.60.0 (d1fd9fe 2022-03-01)

注意 如果 windows 不能输出上述信息,有可能是由于系统变量未设置的问题。
右键此电脑 -> 高级系统设置 -> 环境变量 -> Path -> 新建 -> C:\Users\xxx.cargo\bin;保存即可

rust 同时在本地安装了一个文档服务,rustup doc 让浏览器打开本地文档

卸载

命令行使用 rustup 卸载

$ rustup self uninstall

参考:https://course.rs/about-book.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值