rust 安装添加代理


~/.cargo  目录下创建config 的文本文件

内容为

[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"
replace-with = 'ustc'
[source.ustc]
registry = "git://mirrors.ustc.edu.cn/crates.io-index"

 

再添加环境变量

 sudo nano  ~/.bash_profile

内容为

export RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static

export RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup
如果安装过程中出现各种安装问题 请删除  以上设置

 

以下是原先的方法,不推荐使用
步骤如下:
1. 打开Powershell(注意不是cmd)
2. 输入以下文本
 1    $proxy='http://127.0.0.1:1080'
 2     $ENV:HTTP_PROXY=$proxy
 3       $ENV:HTTPS_PROXY=$proxy
 
 
.\rustup-init.exe

proxy为代理地址
---------------------

 

如果你使用 Linux 或 macOS,打开终端并输入如下命令:

$ curl https://sh.rustup.rs -sSf | sh

更新rustup
rustup self update
更新rust编译器最新的nightly版本
rust update nightly
安装RLS 标准化 编译器增强工具

rustup component add rls --toolchain nightly
rustup component add rust-analysis --toolchain nightly
rustup component add rust-src --toolchain nightly



(Optional) Set RUST_SRC_PATH environment variable to point to the 'src' dir in the Rust source installation e.g. 

 % export RUST_SRC_PATH=/usr/local/src/rust/src 

            or

   % export RUST_SRC_PATH="$(rustc --print sysroot)/lib/rustlib/src/rust/src"

It's recommended to set RUST_SRC_PATH for speed up, but racer detects it automatically if you don't set it.

 




免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM