Rust安装及配置

下载rustup 从此处下载,如果你需要安装vs的cpp生成工具,可以在这个页面进行下载。 设置rustup镜像 字节提供的镜像 https://rsproxy.cn export RUSTUP_DIST_SERVER="https://rsproxy.cn" export RUSTUP_UPDATE_ROOT="https://rsproxy.cn/rustup" 设置两个环境变量即可 设置环境变量 RUSTUP_DIST_SERVER (用于更新 toolchain) export RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static 以及 RUSTUP_UPDATE_ROOT (用于更新 rustup) export RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup 设置RUSTUP_HOME和CARGO_HOME可以实现自定义安装路径 crates.io 镜像 编辑 ~/.cargo/config ,这里使用的是中科大的镜像。 [source.crates-io] replace-with = 'ustc' [source.ustc] registry = "git://mirrors.ustc.edu.cn/crates.io-index" 或者使用字节的,参考官网文档 [source.crates-io] replace-with = 'rsproxy-sparse' [source.rsproxy] registry = "https://rsproxy.cn/crates.io-index" [source.rsproxy-sparse] registry = "sparse+https://rsproxy.cn/index/" [registries.rsproxy] index = "https://rsproxy.cn/crates.io-index" [net] git-fetch-with-cli = true 安装Rust Windows 安装rust即可。可以参考我的步骤,如果安装的是vs的cpp build tools,可以跳过。 Current installation options: default host triple: x86_64-pc-windows-msvc default toolchain: stable (default) profile: default modify PATH variable: yes 1) Proceed with installation (default) 2) Customize installation 3) Cancel installation >2 I'm going to ask you the value of each of these installation options....

February 28, 2022 · 7 min · czyt