【rust】rust安装,运行第一个Rust 程序 (1)
安装 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卸载
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)的更多相关文章
- 运行第一个Hadoop程序,WordCount
系统: Ubuntu14.04 Hadoop版本: 2.7.2 参照http://www.cnblogs.com/taichu/p/5264185.html中的分享,来学习运行第一个hadoop程序. ...
- Spark认识&环境搭建&运行第一个Spark程序
摘要:Spark作为新一代大数据计算引擎,因为内存计算的特性,具有比hadoop更快的计算速度.这里总结下对Spark的认识.虚拟机Spark安装.Spark开发环境搭建及编写第一个scala程序.运 ...
- 运行第一个ruby程序
0x00 安装 首先需要安装一个ruby的环境,ruby分为win.linux.macOS版本.不用系统安装方法略有差异,不在这进行讲解. 0x01 运行第一个ruby程序 我这里是win环境,打开命 ...
- 运行第一个python程序,python 变量,常量,注释
一.运行第一个python程序: print('Hello,world') 保存为.py文件 在cmd窗口: python3x:python py文件路径 回车 python2x:python p ...
- OpenCV学习笔记(一)安装及运行第一个OpenCV程序
1.下载及安装 OpenCV是一套开源免费的图形库,主要有C/C++语言编写,官网: http://opencv.org/ .在 http://opencv.org/downloads.html 可以 ...
- 使用Eclipse运行第一个Go程序
Windows 10家庭中文版,go version go1.11 windows/amd64, Eclipse IDE for C/C++ Developers Photon Release (4. ...
- [IOS]从零开始搭建基于Xcode7的IOS开发环境和免开发者帐号真机调试运行第一个IOS程序HelloWorld
首先这篇文章比较长,若想了解Xcode7的免开发者帐号真机调试运行IOS程序的话,直接转到第五部分. 转载请注明原文地址:http://www.cnblogs.com/litou/p/4843772. ...
- 编译运行第一个Java程序——通过示例学习Java编程3
作者:CHAITANYA SINGH 来源:https://www.koofun.com//pro/kfpostsdetail?kfpostsid=13 在本教程中,我们将了解如何编写.编译和运行Ja ...
- python基础(2):python的安装、第一个python程序
1. 第一个python程序 1.1 python的安装 自己百度,这是自学最基本的,安装一路确定即可,记得path下打钩. 1.2 python的编写 python程序有两种编写方式: 1.进入cm ...
随机推荐
- mysql 锁超时
对一个别人正在读写的表执行DDL操作,经常需要先锁表,但是这个表正在被人执行读写操作,那么就会报:Lock wait timeout 类的错误. 通过MDB实例详情页面的进程管理可以看到类似如下的情况 ...
- python实例1-找质数/素数
质数定义:质数(prime number)又称素数.质数定义为在大于1的自然数中,除了1和它本身以外不再有其他因数. 示例解决方案1 有很多方法可以解决这个问题,下面是一些例子:这是一个不同的功能分解 ...
- jmeter的cookie跨线程传递
测试计划需要设置成独立运行每个线程组获取cookie需要先执行才能使接下来的cookie使用正确执行 登录线程组登录,使用正则表达式提取器提取所需cookie然后使用BeanShellPostProc ...
- 【HANA系列】SAP HANA SQL获取当前日期加若干天后的日期
公众号:SAP Technical 本文作者:matinal 原文出处:http://www.cnblogs.com/SAPmatinal/ 原文链接:[HANA系列]SAP HANA SQL获取当前 ...
- JavaSE_Java跨平台原理
Java语言的核心优势就是跨平台. C/C++语言都是直接编译成针对特定平台的机器码,如果要跨平台,需要借用相应的编译器重新编译.Java源程序(.java)要先编译成与平台无关的字节码文件(.cla ...
- 多线程15-ReaderWriterLockSlim
)); } ); rwl.EnterUpgradeableReadLock(); ...
- 小白用Mac
老话说的好,“最近老板发我一个Mac,但是不会用,嘎嘎嘎嘎” 1.安装软件 安装 Homebrew Homebrew:使用 Homebrew 安装 Apple 没有预装但 你需要的东西,尤其是非界面管 ...
- 小明种苹果(续)第十七次CCF认证
小明种苹果(续)第十七次CCF认证 题目 原题链接 ](http://118.190.20.162/view.page?gpid=T93) 很高心,在现在CCF CSP可以下载自己当时的答卷了,也就是 ...
- MySQL总结(3)
ORDER BY 与 GROUP BY ORDER BY GROUP BY 排序产生的输出 分组行.但输出可能不是分组的顺序 不一定需要 如果与聚集函数一起使用列(或表达式)则必须使用 任意列都可以使 ...
- Scrapy 教程(九)-日志系统
最新版本的 scrapy 已经废弃了 scrapy.log 的使用,赞成显示调用python标准日志记录. Python 内建日志系统 import logging ### python 内建 log ...