加入收藏 | 设为首页 | 会员中心 | 我要投稿 PHP编程网 - 黄冈站长网 (http://www.0713zz.com/)- 数据应用、建站、人体识别、智能机器人、语音技术!
当前位置: 首页 > 服务器 > 搭建环境 > Windows > 正文

如何在Linux中安装Rust编程语言

发布时间:2019-01-19 05:30:52 所属栏目:Windows 来源:Prakash Subramanian
导读:副标题#e# Rust 通常被称为 rust-lang。Rust 是一个由 Mozilla Research 赞助的通用的、多范式、现代的、跨平台和开源系统编程语言。 它旨在实现安全性、速度和并发性等目标。 Rust 在语法上与 C++ 相似,但它的设计者希望它在保持性能的同时提供更好的内存
副标题[/!--empirenews.page--]

如何在Linux中安装Rust编程语言

Rust 通常被称为 rust-lang。Rust 是一个由 Mozilla Research 赞助的通用的、多范式、现代的、跨平台和开源系统编程语言。

它旨在实现安全性、速度和并发性等目标。

Rust 在语法上与 C++ 相似,但它的设计者希望它在保持性能的同时提供更好的内存安全性。

Rust 目前在许多组织中使用,例如 Firefox、Chef、Dropbox、Oracle、GNOME 等。

如何在 Linux 中安装 Rust 语言?

我们可以通过多种方式安装 Rust,但以下是官方推荐的安装方式。

  1. $ curl https://sh.rustup.rs -sSf | sh
  2. info: downloading installer
  3.  
  4. Welcome to Rust!
  5.  
  6. This will download and install the official compiler for the Rust programming
  7. language, and its package manager, Cargo.
  8.  
  9. It will add the cargo, rustc, rustup and other commands to Cargo's bin
  10. directory, located at:
  11.  
  12. /home/daygeek/.cargo/bin
  13.  
  14. This path will then be added to your PATH environment variable by modifying the
  15. profile files located at:
  16.  
  17. /home/daygeek/.profile
  18. /home/daygeek/.bash_profile
  19.  
  20. You can uninstall at any time with rustup self uninstall and these changes will
  21. be reverted.
  22.  
  23. Current installation options:
  24.  
  25. default host triple: x86_64-unknown-linux-gnu
  26. default toolchain: stable
  27. modify PATH variable: yes
  28.  
  29. 1) Proceed with installation (default)
  30. 2) Customize installation
  31. 3) Cancel installation
  32. >1
  33.  
  34. info: syncing channel updates for 'stable-x86_64-unknown-linux-gnu'
  35. info: latest update on 2018-12-06, rust version 1.31.0 (abe02cefd 2018-12-04)
  36. info: downloading component 'rustc'
  37. 77.7 MiB / 77.7 MiB (100 %) 1.2 MiB/s ETA: 0 s
  38. info: downloading component 'rust-std'
  39. 54.2 MiB / 54.2 MiB (100 %) 1.2 MiB/s ETA: 0 s
  40. info: downloading component 'cargo'
  41. 4.7 MiB / 4.7 MiB (100 %) 1.2 MiB/s ETA: 0 s
  42. info: downloading component 'rust-docs'
  43. 8.5 MiB / 8.5 MiB (100 %) 1.2 MiB/s ETA: 0 s
  44. info: installing component 'rustc'
  45. info: installing component 'rust-std'
  46. info: installing component 'cargo'
  47. info: installing component 'rust-docs'
  48. info: default toolchain set to 'stable'
  49.  
  50. stable installed - rustc 1.31.0 (abe02cefd 2018-12-04)
  51.  
  52.  
  53. Rust is installed now. Great!
  54.  
  55. To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH
  56. environment variable. Next time you log in this will be done automatically.
  57.  
  58. To configure your current shell run source $HOME/.cargo/env

运行以下命令配置当前 shell。

  1. $ source $HOME/.cargo/env

运行以下命令验证已安装的 Rust 版本。

  1. $ rustc --version
  2. rustc 1.31.0 (abe02cefd 2018-12-04)

如何测试 Rust 编程语言?

安装 Rust 后,请按照以下步骤检查 Rust 语言是否正常工作。

  1. $ mkdir ~/projects
  2. $ cd ~/projects
  3. $ mkdir hello_world
  4. $ cd hello_world

(编辑:PHP编程网 - 黄冈站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

热点阅读