安装Rust(Windows 10 与 CentOS7)

2023-05-16

注:安装及下载需要科学上网 

官网下载地址:Install Rust - Rust Programming Language

Window安装Rust 

0、前提条件

安装C++编译工具(如下图所示)

1、下载安装程序

2、设置环境变量(可略过)

可以通过设置环境变量,将rust安装到自己设置的目录中,不设置安装到默认的路径C:\Users\用户名\.rust中。

2.1、搜索“环境变量”

2.2、打开系统属性 > 高级 > 环境变量

2.3、用户变量或系统变量 > 新建

2.4、添加环境变量

  • RUSTUP_HOME
  • CARGO_HOME

3、安装rust

3.1、双击下载的rustup-init.exe文件

 

3.2、输入2

 

3.3、根据提示进行输入或回车(默认)

第1步中输入:x86_64-pc-windows-gnu   后面直接回车即可,最后安装输入1

3.4、等待安装完成

4、验证

打开命令提示符窗囗,输入如下命令进行验证:

rustc --version 

CentOS7 安装 Rust

1、安装Rust

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

安装过程中,需要选择1,2,3,输入1进行默认安装即可,如下所示:

[root@localhost ~]# curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
info: downloading installer
Warning: Not enforcing strong cipher suites for TLS, this is potentially less secure

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:

  /root/.rustup

This can be modified with the RUSTUP_HOME environment variable.

The Cargo home directory is located at:

  /root/.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:

  /root/.cargo/bin

This path will then be added to your PATH environment variable by
modifying the profile files located at:

  /root/.profile
  /root/.bash_profile
  /root/.bashrc

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 installation (default)
2) Customize installation
3) Cancel installation
>1

info: profile set to 'default'
info: default host triple is x86_64-unknown-linux-gnu
info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
info: latest update on 2022-09-22, rust version 1.64.0 (a55dd71d5 2022-09-19)
info: downloading component 'cargo'
  6.4 MiB /   6.4 MiB (100 %) 979.2 KiB/s in  6s ETA:  0s
info: downloading component 'clippy'
  2.8 MiB /   2.8 MiB (100 %) 1023.7 KiB/s in  3s ETA:  0s
info: downloading component 'rust-docs'
 18.8 MiB /  18.8 MiB (100 %) 985.6 KiB/s in 20s ETA:  0s 
info: downloading component 'rust-std'
 27.4 MiB /  27.4 MiB (100 %) 924.8 KiB/s in 29s ETA:  0s 
info: downloading component 'rustc'
 18.7 MiB /  54.2 MiB ( 34 %) 812.8 KiB/s in  1m  4s ETA: 44s
info: retrying download for 'https://static.rust-lang.org/dist/2022-09-22/rustc-1.64.0-x86_64-unknown-linux-gnu.tar.xz'
 54.2 MiB /  54.2 MiB (100 %) 940.8 KiB/s in 58s ETA:  0s 
info: downloading component 'rustfmt'
  4.3 MiB /   4.3 MiB (100 %) 955.9 KiB/s in  4s ETA:  0s
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'
 18.8 MiB /  18.8 MiB (100 %)   2.8 MiB/s in  6s ETA:  0s
info: installing component 'rust-std'
 27.4 MiB /  27.4 MiB (100 %)  13.2 MiB/s in  2s ETA:  0s
info: installing component 'rustc'
 54.2 MiB /  54.2 MiB (100 %)  15.2 MiB/s in  3s ETA:  0s
info: installing component 'rustfmt'
info: default toolchain set to 'stable-x86_64-unknown-linux-gnu'

  stable-x86_64-unknown-linux-gnu installed - rustc 1.64.0 (a55dd71d5 2022-09-19)


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, run:
source "$HOME/.cargo/env"

2、使环境生效

source $HOME/.cargo/env

[root@localhost ~]# rustc -V
bash: rustc: command not found...              #环境未生效
[root@localhost ~]# source $HOME/.cargo/env    #使环境生效
[root@localhost ~]# rustc -V
rustc 1.64.0 (a55dd71d5 2022-09-19)            #环境已生效,得到版本信息
[root@localhost ~]# cargo --version
cargo 1.64.0 (387270bc7 2022-09-16)

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

安装Rust(Windows 10 与 CentOS7) 的相关文章

随机推荐

  • java8转换数组。找到最接近指定数据

    List lt String gt lsstr 61 Arrays asList arear 数组转list List lt String gt listWithoutNulls 61 lsstr stream filter Objects
  • nested exception is java.lang.IllegalStat eException:duplicate spring bean

    nested exception is java lang IllegalStat eException duplicate spring bean 多次注入bean信息 xff0c 经过长时间排查 xff0c 我是将项目进行整合 xff0
  • Artifact xxx:war exploded: Error during artifact deployment.

    Artifact xxx war exploded Error during artifact deployment 出现这个问题 xff0c 在网上查资料 xff0c 1 说是idear 配置的tomcat Artifact 添加的Var
  • zTree取消父子关联

    对于zTree父子关联关系的设置 xff0c zTree里面自带了一个chkboxType函数 取消父子关联 xff0c 只需要在初始化树的时候 xff0c 在settings里面设置 xff1a check enable true chk
  • 解决Linux系统下,出现“不在sudoers文件中,此事将被报告”的问题

    使用sudo mkdir software xff0c 提示XXX 不在 sudoers 文件中 此事将被报告 是因为当前操作用户的权限不足 xff0c 而root用户只有在权限分配及系统设置时才会使用 xff0c 而root用户的密码也不
  • 结构体数组的引用方式

    期末复习时发现答案中有p i a的用法 xff0c 遂进行了一番测试 xff0c 所获心得记载如下 引用结构体指针数组时 xff0c p i 61 61 A i 61 61 p 43 i 注意加括号 xff0c 优先级较低 具体为 xff1
  • Hadoop安装和配置

    1 安装Hadoop 注意 xff1a 安装JDK类似 xff0c 解压后配置环境变量 1 0 Hadoop下载地址 xff1a https archive apache org dist hadoop common hadoop 2 7
  • 机器学习(1)机器学习的范围

    机器学习的范围包括但是不局限与如下 xff1a 机器学习跟模式识别 xff0c 统计学习 xff0c 数据挖掘 xff0c 计算机视觉 xff0c 语音识别 xff0c 自然语言处理等领域有着很深的联系 从范围上来说 xff0c 机器学习跟
  • Tesseract-OCR-v5.0中文识别,训练自定义字库,提高图片的识别效果

    1 xff0c 下载安装Tesseract OCR 安装 xff0c 链接地址Index of tesseract 2 xff0c 安装成功 tesseract v 注意 xff1a 安装后 xff0c 要添加系统环境变量 3 xff0c
  • 4x4矩阵按键应用详解

    一 简介 4x4矩阵按键是单片机外部设备中所使用的排布类似于矩阵的按键组 显然矩阵按键的使用要比独立按键要复杂一些 xff0c 编程也要复杂一些 xff0c 但可以单片机IO资源 4x4矩阵按键即分为4组列线 xff0c 4组行线 xff0
  • Hyper-V 显卡直通

    创建虚拟机后 xff0c 打开虚拟机设置 gt 禁用检查点功能 使用WIN11镜像来部署安装Hyper V虚拟机系统 xff0c 进入桌面后关闭虚拟机 物理机以管理员运行Windows PowerShell 输入以下命令 vm 61 34
  • mwan3 负载平衡 多PPPOE账号 LTE WIFI 负载均衡

    OpenWrt上的MWAN3可以支持多根网线或者多个PPPOE账号的同时拨号使用和负载均衡 并且还可以通过Ping方式来检测中断线路并自动屏蔽中断线路 mwan3的详细介绍 https openwrt org docs guide user
  • websocket实现页面数据实时加载(Springboot+vue)

    在这里先提供两种思路 要实现页面数据的实时加载有两种方式 xff0c 第一种是长轮询的方式 要么是后台长轮询 xff0c 检测到数据变化时 xff0c 通知websocket你该更新一下数据了 要么是前台长轮询 xff0c 每隔一段时间发起
  • 【Cocos2d-x】使用贝塞尔曲线(Bezier)实现精灵抛物线运动

    Cocos2d x中的贝塞尔曲线 在Cocos2d x中贝塞尔曲线运动的封装类为CCBezierTo和CCBezierBy 这两个Action都需要传入一个参数ccBezierConfig xff0c 这是一个结构体 xff0c 这个结构体
  • 常用开源Jabber(XMPP) IM服务器介绍

    转自 xff1a http www kfdoc com Article kaifayuyan Java 200909 283 html 1 Openfire Wildfire 3 x 授权 GPL or 商用 操作系统平台 xff1a 所有
  • socket缓冲区大小设置

    系统提供的socket缓冲区大小为8K xff0c 你可以将之设置为64K xff0c 尤其在传输实时视频时 设置发送和接收缓冲区 int rcvbuf int rcvbufsize 61 sizeof int if getsockopt
  • CentOS 7 安装PostgreSQL

    原文 xff1a https blog csdn net wlwlwlwl015 article details 53256358 下载 在postgresql的官方即可找到源码文件目录 xff0c 地址如下 xff1a https www
  • 使用sudo apt-get update总是报错软件包缓存文件损坏

    命中 1 http cn archive ubuntu com ubuntu xenial InRelease 获取 2 http cn archive ubuntu com ubuntu xenial updates InRelease
  • CSP202112 第四题 磁盘文件操作(C++ 25分)

    使用了tuple xff0c 但这么使用的话 xff0c 只能符合前25 的数据 xff0c 即m小于等于10000 include lt bits stdc 43 43 h gt include lt tuple gt using nam
  • 安装Rust(Windows 10 与 CentOS7)

    注 xff1a 安装及下载需要科学上网 官网下载地址 xff1a Install Rust Rust Programming Language Window安装Rust 0 前提条件 安装C 43 43 编译工具 xff08 如下图所示 x