Rust学习笔记000 安装

安装命令

  • curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
info: downloading installerWelcome 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:/home/ubuntu/.rustupThis can be modified with the RUSTUP_HOME environment variable.The Cargo home directory is located at:/home/ubuntu/.cargoThis 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:/home/ubuntu/.cargo/binThis path will then be added to your PATH environment variable by
modifying the profile files located at:/home/ubuntu/.profile/home/ubuntu/.bash_profile/home/ubuntu/.bashrcYou 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-gnudefault toolchain: stable (default)profile: defaultmodify PATH variable: yes1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>
  • enter后报错:
    error: could not amend shell profile: ‘/home/ubuntu/.bash_profile’: could not write rcfile file: ‘/home/ubuntu/.bash_profile’: Permission denied (os error 13)

  • 使用命令curl https://sh.rustup.rs -sSf | sh -s – --no-modify-path

$ curl https://sh.rustup.rs -sSf | sh -s -- --no-modify-path 
info: downloading installerWelcome 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:/home/ubuntu/.rustupThis can be modified with the RUSTUP_HOME environment variable.The Cargo home directory is located at:/home/ubuntu/.cargoThis 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:/home/ubuntu/.cargo/binThis path needs to be in your PATH environment variable,
but will not be added automatically.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-gnudefault toolchain: stable (default)profile: defaultmodify PATH variable: no1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>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 2023-12-28, rust version 1.75.0 (82e1608df 2023-12-21)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
info: downloading component 'rust-std'
info: downloading component 'rustc'61.4 MiB /  61.4 MiB (100 %)  41.1 MiB/s in  2s ETA:  0s
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'rust-docs'14.3 MiB /  14.3 MiB (100 %)   5.7 MiB/s in  2s ETA:  0s
info: installing component 'rust-std'23.6 MiB /  23.6 MiB (100 %)  10.4 MiB/s in  2s ETA:  0s
info: installing component 'rustc'61.4 MiB /  61.4 MiB (100 %)  11.5 MiB/s in  5s 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.75.0 (82e1608df 2023-12-21)Rust is installed now. Great!To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH
environment variable. This has not been done automatically.To configure your current shell, run:
source "$HOME/.cargo/env"
  • 将 Rust 工具链目录添加到 PATH 环境变量中:
source "$HOME/.cargo/env"
  • 测试
$ rustc --version
rustc 1.75.0 (82e1608df 2023-12-21)
$ vim test.rs
$ rustc test.rs 
$ ./test 
test

在这里插入图片描述

错误处理

curl: (1) Protocol “https” not supported or disabled in libcurl

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/311818.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

计算机网络【HTTP 灵魂拷问?】

1. HTTP 报文结构是怎样的? 对于 TCP 而言,在传输的时候分为两个部分:TCP头和数据部分。 而 HTTP 类似,也是header body的结构,具体而言: 起始行 头部 空行 实体由于 http 请求报文和响应报文是有一定区别,因此…

Plantuml之甘特图语法介绍(二十八)

简介: CSDN博客专家,专注Android/Linux系统,分享多mic语音方案、音视频、编解码等技术,与大家一起成长! 优质专栏:Audio工程师进阶系列【原创干货持续更新中……】🚀 优质专栏:多媒…

2023-12-21 LeetCode每日一题(美丽塔 II)

2023-12-21每日一题 一、题目编号 2866. 美丽塔 II二、题目链接 点击跳转到题目位置 三、题目描述 给你一个长度为 n 下标从 0 开始的整数数组 maxHeights 。 你的任务是在坐标轴上建 n 座塔。第 i 座塔的下标为 i ,高度为 heights[i] 。 如果以下条件满足&a…

【Google】关于Google Analytics埋点及API获取数据

本文是在实际操作中踩到的一些坑,并不是操作手册。具体的还是需要仔细按照官方文档操作。 参考文档:https://developers.google.com/analytics/ 重点看标红的文档即可 普通事件埋点 各端需要跟产品端确定好统一的事件名称和参数,否则数据混…

ACW741.斐波那契额数列

输入整数 N,求出斐波那契数列中的第 N项是多少。 斐波那契数列的第 0项是 0,第 1项是 1,从第 2 项开始的每一项都等于前两项之和。输入格式 第一行包含整数 T,表示共有T个测试数据。接下来 T行,每行包含一个整数 N。输…

elasticsearch系列五:集群的备份与恢复

概述 前几篇咱们讲了es的语法、存储的优化、常规运维等等,今天咱们看下如何备份数据和恢复数据。 在传统的关系型数据库中我们有多种备份方式,常见有热备、冷备、全量定时增量备份、通过开发程序备份等等,其实在es中是一样的。 官方建议采用s…

C Primer Plus 第6版 编程练习 chapter 12

文章目录 1. 第1题1.1 题目描述1.2 编程源码1.3 结果显示 2. 第2题2.1 题目描述2.2 编程源码2.2.1 pe12-2a.h源码2.2.2 pe12-2a.c源码2.2.3 pe12-2b.c源码 2.3 结果显示 3. 第3题3.1 题目描述3.2 编程源码3.2.1 pe12-2a.h源码3.2.2 pe12-2a.c源码3.2.3 pe12-2b.c源码 3.3 结果显…

[每周一更]-(第43期):Golang版本的升级历程

从1.13接触go语言开始更新我们公司内第一个Go项目,直至现在go版本已经发展到1.20(20230428),我们从go发版开始认识go语言,有利于我们更深入 了解这门语言,洞悉一些深层方式,加深我们学习的动力&…

深入探索小红书笔记详情API:解锁内容创新的无尽潜力

一、引言 在当今信息爆炸的时代,内容创新已经成为品牌和个人脱颖而出的关键。小红书,作为全球最大的消费类口碑库之一,每天产生大量的用户生成内容。而小红书笔记详情API,作为一个强大的工具,能够为内容创作者提供深入…

前后台分离开发

前后台分离开发 简介 前后台分离开发,就是在项目开发过程中,对于前端代码的开发由专门的前端开发人员负责,后端代码则由后端开发人员负责,这样可以做到分工明确、各司其职,提高开发效率,前后端代码并行开…

【linux】tail的基本使用

在linux可以用find查找一个文件,可以用grep查找符合要求的文件内容,但是有的时候希望查看文件的前几行或者后几行(其实这种场景经常可以遇到,比如接触到日志分析的时候),那就应该使用head和tail这两个工具了…

2023-12-24 LeetCode每日一题(收集足够苹果的最小花园周长)

2023-12-24每日一题 一、题目编号 1954. 收集足够苹果的最小花园周长二、题目链接 点击跳转到题目位置 三、题目描述 给你一个用无限二维网格表示的花园,每一个 整数坐标处都有一棵苹果树。整数坐标 (i, j) 处的苹果树有 |i| |j| 个苹果。 你将会买下正中心坐…