Rust安裝指南(包括安裝後會碰到的問題和解決方法

前提: 支持http或sock5的代理軟件
變量命名是Powershell特有的
cmd的請先在目錄下輸入powershell進行切換

$proxy='socks5://127.0.0.1:1080'
$ENV:HTTP_PROXY=$proxy
$ENV:HTTPS_PROXY=$proxy

之後運行./rustup-init.exe

安裝結束
在這裏插入圖片描述
Good luck!

關於安裝版本(default host triple)的選擇

根據C的編譯環境:
x86_64-pc-windows-msvc --> VC++
x86_64-pc-windows-gnu --> MinGW
注意版本選擇 否則會導致編譯異常

cargo 安裝慢

cargo是個優秀的模塊管理工具
C:\Users\Administrator.cargo
新建文件名config

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

安裝cargo install cargo-edit爲了讓Cargo.toml操作更加方便

參考

https://stackoverflow.com/questions/42843329/how-can-i-install-rust-using-rustup-on-windows-when-behind-a-firewall
https://github.com/rust-lang/rust/issues/44787#issuecomment-331629387
https://stackoverflow.com/questions/37706999/error-installing-a-crate-via-cargo-specified-package-has-no-binaries

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章