安装 Rust

在 Unix 类系统如 Linux 和 macOS 上,打开终端并输入:

curl https://sh.rustup.rs -sSf | sh

回车后安装过程出现如下显示:

info: downloading installer

Welcome to Rust!

This will download and install the official compiler for the Rust programming
language, and its package manager, Cargo. It will add the cargo, rustc, rustup and other commands 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 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
modify PATH variable: yes ) Proceed with installation (default)
) Customize installation
) Cancel installation

选择 1 ,回车继续;

这样会下载一个脚本并开始安装。如果一切顺利,你将会看到:

Current installation options:

   default host triple: x86_64-unknown-linux-gnu
default toolchain: stable
modify PATH variable: yes ) Proceed with installation (default)
) Customize installation
) Cancel installation
> info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
334.4 KiB / 334.4 KiB ( %) 191.0 KiB/s ETA: s
info: latest update on --, rust version 1.34. (6c2484dc3 --)
info: downloading component 'rustc'
85.3 MiB / 85.3 MiB ( %) 172.7 KiB/s ETA: s
info: downloading component 'rust-std'
56.1 MiB / 56.1 MiB ( %) 182.4 KiB/s ETA: s
info: downloading component 'cargo'
4.3 MiB / 4.3 MiB ( %) 188.8 KiB/s ETA: s
info: downloading component 'rust-docs'
10.2 MiB / 10.2 MiB ( %) 169.4 KiB/s ETA: s
info: installing component 'rustc'
85.3 MiB / 85.3 MiB ( %) 12.8 MiB/s ETA: s
info: installing component 'rust-std'
56.1 MiB / 56.1 MiB ( %) 13.3 MiB/s ETA: s
info: installing component 'cargo'
info: installing component 'rust-docs'
10.2 MiB / 10.2 MiB ( %) 1.2 MiB/s ETA: s
info: default toolchain set to 'stable' stable installed - rustc 1.34. (6c2484dc3 --) Rust is installed now. Great! To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH
environment variable. Next time you log in this will be done automatically. To configure your current shell run source $HOME/.cargo/env

如上显示代表安装完成;

rust卸载

卸载 Rust 跟安装它一样容易:
rustup self uninstall

第一个Rust程序

依据惯例,打印hello,world

编辑创建文件main.rs

fn main() {
println!("Hello, world!");
}

编译(类似于C语言的gcc编译):

rustc  main.rs

运行:

./main

输出:

Hello, world!

【rust】rust安装,运行第一个Rust 程序 (1)的更多相关文章

  1. 运行第一个Hadoop程序,WordCount

    系统: Ubuntu14.04 Hadoop版本: 2.7.2 参照http://www.cnblogs.com/taichu/p/5264185.html中的分享,来学习运行第一个hadoop程序. ...

  2. Spark认识&环境搭建&运行第一个Spark程序

    摘要:Spark作为新一代大数据计算引擎,因为内存计算的特性,具有比hadoop更快的计算速度.这里总结下对Spark的认识.虚拟机Spark安装.Spark开发环境搭建及编写第一个scala程序.运 ...

  3. 运行第一个ruby程序

    0x00 安装 首先需要安装一个ruby的环境,ruby分为win.linux.macOS版本.不用系统安装方法略有差异,不在这进行讲解. 0x01 运行第一个ruby程序 我这里是win环境,打开命 ...

  4. 运行第一个python程序,python 变量,常量,注释

    一.运行第一个python程序: print('Hello,world') 保存为.py文件 在cmd窗口: python3x:python  py文件路径 回车 python2x:python  p ...

  5. OpenCV学习笔记(一)安装及运行第一个OpenCV程序

    1.下载及安装 OpenCV是一套开源免费的图形库,主要有C/C++语言编写,官网: http://opencv.org/ .在 http://opencv.org/downloads.html 可以 ...

  6. 使用Eclipse运行第一个Go程序

    Windows 10家庭中文版,go version go1.11 windows/amd64, Eclipse IDE for C/C++ Developers Photon Release (4. ...

  7. [IOS]从零开始搭建基于Xcode7的IOS开发环境和免开发者帐号真机调试运行第一个IOS程序HelloWorld

    首先这篇文章比较长,若想了解Xcode7的免开发者帐号真机调试运行IOS程序的话,直接转到第五部分. 转载请注明原文地址:http://www.cnblogs.com/litou/p/4843772. ...

  8. 编译运行第一个Java程序——通过示例学习Java编程3

    作者:CHAITANYA SINGH 来源:https://www.koofun.com//pro/kfpostsdetail?kfpostsid=13 在本教程中,我们将了解如何编写.编译和运行Ja ...

  9. python基础(2):python的安装、第一个python程序

    1. 第一个python程序 1.1 python的安装 自己百度,这是自学最基本的,安装一路确定即可,记得path下打钩. 1.2 python的编写 python程序有两种编写方式: 1.进入cm ...

随机推荐

  1. Java ——泛型 序列化

    本节重点思维导图 泛型  序列化  泛型 import java.util.ArrayList; import java.util.Date; import java.util.Iterator; i ...

  2. cocos2dx基础篇(21) 进度条CCProgressTimer

    [3.x] (1)去掉 "CC" (2)CCProgressTimerType 改为强枚举 ProgressTimer::Type:: // RADIAL //扇形进度计时器 BA ...

  3. 第四周Java实验总结&学习总结

    实验二 Java简单类与对象 实验目的 掌握类的定义,熟悉属性.构造函数.方法的作用,掌握用类作为类型声明变量和方法返回值: 理解类和对象的区别,掌握构造函数的使用,熟悉通过对象名引用实例的方法和属性 ...

  4. 2019CSP-S游记(?)

    认识我的人都知道,我懒得写算法和模拟赛的博客,但是游记就不一样了,它比较好玩. Day0 中午随便收拾了下就坐高铁出发了,一个小时左右就到南昌了,随后坐公交,再步行到宾馆安置(也没多远). 宾馆离学校 ...

  5. Redis在Windows环境配置多实例多端口运行

    Redis是一种跨平台NoSql内存数据库,这几年各大公司系统应用中非常多见,支持多种数据类型,可以持久化保存数据,很多公司直接拿来作为数据库使用. 相比于Memcached,Redis支持持久化保存 ...

  6. @-webkit-keyframes 动画 css3

    Internet Explorer 10.Firefox 以及 Opera 支持 @keyframes 规则和 animation 属性. Chrome 和 Safari 需要前缀 -webkit-. ...

  7. linux 进程1

    一. 进程的开始和结束 1.1. main函数的调用 a. 编译链接时的引导代码.操作系统下的应用程序其实在main执行前也需要先执行一段引导代码才能去执行main,我们写应用程序时不用考虑引导代码的 ...

  8. centos7yum安装VirtualBox

    cd 进入目录:/etc/yum.repos.d 新建一个文件virtualbox.repo, 输入如下内容: [virtualbox] name=Oracle Linux / RHEL / Cent ...

  9. HNUSTOJ-1638 遍地桔子(贪心)

    1638: 遍地桔子 时间限制: 1 Sec  内存限制: 128 MB提交: 711  解决: 134[提交][状态][讨论版] 题目描述 为了实验室的发展,队长决定在实验室外面的空地种桔子树.空地 ...

  10. Windows 10 IoT Core Dashboard 无法安装的问题

    有人在answers.microsoft.com问这个问题,官方给了个这样的回答,然后还锁定了问题不让别人回复 您好, 了解到您在使用时遇到问题. 请您详细描述下您的操作,请问您是在打开安装程序还是在 ...