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