curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh 提示失败
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
info: downloading installer
curl: (60) SSL certificate problem: certificate has expired
More details here: https://curl.haxx.se/docs/sslcerts.htmlcurl performs SSL certificate verification by default, using a "bundle"of Certificate Authority (CA) public keys (CA certs). If the defaultbundle file isn't adequate, you can specify an alternate fileusing the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented inthe bundle, the certificate verification probably failed due to aproblem with the certificate (it might be expired, or the name mightnot match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, usethe -k (or --insecure) option.
HTTPS-proxy has similar options --proxy-cacert and --proxy-insecure.
rustup: command failed: downloader https://mirrors.tuna.tsinghua.edu.cn/rustup/rustup/dist/x86_64-apple-darwin/rustup-init /var/folders/j_/xj53k3kn3mxb_98p4681ypjh0000gn/T/tmp.NyQVPvg9/rustup-init x86_64-apple-darwin
Other Installation Methods - Rust Forge
请下载对应版本进行安装,1.65.0大约是200M
您在安装 Rustup 时,也会安装 Rust 构建工具和包管理器的最新稳定版,即 Cargo。Cargo 可以做很多事情:
cargo build
可以构建项目cargo run
可以运行项目cargo test
可以测试项目cargo doc
可以为项目构建文档cargo publish
可以将库发布到 crates.io。要检查您是否安装了 Rust 和 Cargo,可以在终端中运行:
cargo --version
Rust 支持多种编辑器
VS CODE
SUBLIME TEXT
ATOM
INTELLIJ IDEA
ECLIPSE
VIM
EMACS
GEANY
cargo new hello-rust
这会生成一个名为 hello-rust
的新目录,其中包含以下文件:
hello-rust
|- Cargo.toml
|- src|- main.rs
Cargo.toml
为 Rust 的清单文件。其中包含了项目的元数据和依赖库。
src/main.rs
为编写应用代码的地方。
cargo new
会生成一个新的“Hello, world!”项目!我们可以进入新创建的目录中,执行下面的命令来运行此程序:
cargo run
Hello, world!