rust编程

win10上安装 Rust

卸载Rust: rustup self uninstall 安装 visual c++ build tools:visualcppbuildtools_full.exe, http://go.microsoft.com/fwlink/?LinkId=691126

下载rustup-init.exe安装: https://www.rust-lang.org/

在安装 Rustup 时,也会安装 Rust 构建工具和包管理器的最新稳定版,即 Cargo。Cargo 可以做很多事情:

  • cargo build 可以构建项目
  • cargo run 可以运行项目
  • cargo test 可以测试项目
  • cargo doc 可以为项目构建文档
  • cargo publish 可以将库发布到 crates.io。

要检查您是否安装了 Rust 和 Cargo,可以在终端中运行: cargo --version

Welcome to Rust!

This will download and install the official compiler for the Rust
programming language, and its package manager, Cargo.

Rustup metadata and toolchains will be installed into the Rustup
home directory, located at:

  C:\Users\username\.rustup

This can be modified with the RUSTUP_HOME environment variable.

The Cargo home directory located at:

  C:\Users\username\.cargo

This can be modified with the CARGO_HOME environment variable.

The cargo, rustc, rustup and other commands will be added to
Cargo's bin directory, located at:

  C:\Users\username\.cargo\bin

This path will then be added to your PATH environment variable by
modifying the HKEY_CURRENT_USER/Environment/PATH registry key.

You can uninstall at any time with rustup self uninstall and
these changes will be reverted.

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
>

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'
676.1 KiB / 676.1 KiB (100 %) 250.0 KiB/s in  3s ETA:  0s
info: latest update on 2021-03-25, rust version 1.51.0 (2fd73fabe 2021-03-23)
info: downloading component 'cargo'
  3.6 MiB /   3.6 MiB (100 %) 431.3 KiB/s in  8s ETA:  0s
info: downloading component 'clippy'
  1.6 MiB /   1.6 MiB (100 %) 753.0 KiB/s in  2s ETA:  0s
info: downloading component 'rust-docs'
 14.9 MiB /  14.9 MiB (100 %)   1.6 MiB/s in 12s ETA:  0s
info: downloading component 'rust-std'
 21.0 MiB /  21.0 MiB (100 %)   2.9 MiB/s in  9s ETA:  0s
info: downloading component 'rustc'
 50.1 MiB /  50.1 MiB (100 %)   2.5 MiB/s in 16s ETA:  0s
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: using up to 500.0 MiB of RAM to unpack components
info: installing component 'clippy'
info: installing component 'rust-docs'
 14.9 MiB /  14.9 MiB (100 %)   3.7 MiB/s in  2s ETA:  0s
info: installing component 'rust-std'
 21.0 MiB /  21.0 MiB (100 %)  14.2 MiB/s in  6s ETA:  0s
info: installing component 'rustc'
 50.1 MiB /  50.1 MiB (100 %)  16.1 MiB/s in  3s ETA:  0s
info: installing component 'rustfmt'
info: default toolchain set to 'stable-x86_64-pc-windows-msvc'

  stable-x86_64-pc-windows-msvc installed - rustc 1.51.0 (2fd73fabe 2021-03-23)


Rust is installed now. Great!

To get started you need Cargo's bin directory (%USERPROFILE%\.cargo\bin) in
your PATH environment variable. Future applications will automatically
have the correct environment, but you may need to restart your current shell.

Press the Enter key to continue.

%USERPROFILE%\.cargo\bin 加入系统path,并重启shell.

更新 rust: rustup update

资源

© Licensed under CC BY-NC-SA 4.0

大多数人宁愿死去, 也不愿思考。 — 事实上他们也确实到死都没有思考。——罗素

发表我的评论
取消评论
表情

Hi,您需要填写昵称和邮箱!