当前位置: 首页 > news >正文

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.lryc.cn/news/270966.html

相关文章:

  • python AI五子棋对战
  • 图文证明 费马,罗尔,拉格朗日,柯西
  • CEC2017(Python):粒子群优化算法PSO求解CEC2017(提供Python代码)
  • AUTOSAR从入门到精通- 虚拟功能总线(RTE)(一)
  • B/S架构云端SaaS服务的医院云HIS系统源码,自主研发,支持电子病历4级
  • 看懂基本的电路原理图(入门)
  • 赫夫曼树基本数据结构
  • 10TB海量JSON数据从OSS迁移至MaxCompute
  • LLM之RAG实战(九)| 高级RAG 03:多文档RAG体系结构
  • Windows电脑引导损坏?按照这个教程能修复
  • 记Android字符串资源支持的参数类型
  • Java实现树结构(为前端实现级联菜单或者是下拉菜单接口)
  • MySQL中常用的数据类型
  • HTML+CSS+JS制作三款雪花酷炫特效
  • [C#]使用ONNXRuntime部署一种用于边缘检测的轻量级密集卷积神经网络LDC
  • ZigBee案例笔记 - 无线点灯
  • Debezium日常分享系列之:向 Debezium 连接器发送信号
  • 《C#程序设计教程》总复习
  • 为什么ChatGPT选择了SSE,而不是WebSocket?
  • appium入门基础
  • jsp介绍
  • Debian安装k8s记录
  • 第6课 用window API捕获麦克风数据并加入队列备用
  • 图片预览 element-plus 带页码
  • 【小白专用】winform启动界面+登录窗口 更新2024.1.1
  • 自动化网络故障修复管理
  • Git:常用命令(二)
  • Oracle 12c rac 搭建 dg
  • Cisco模拟器-交换机端口的隔离
  • zdppy_api框架快速入门