温馨提示:最新内容仅在原文更新。

国内源使用字节的RsProxy https://rsproxy.cn/

配置环境变量

Mac

export RUSTUP_DIST_SERVER="https://rsproxy.cn"
export RUSTUP_UPDATE_ROOT="https://rsproxy.cn/rustup"

Windows

创建下面的系统环境变量

  1. 变量 RUSTUP_DIST_SERVER ,值 https://rsproxy.cn

  2. 变量 RUSTUP_UPDATE_ROOT ,值 https://rsproxy.cn/rustup

添加配置

新建配置文件

若对应的位置不存在 config 或者 config.toml 文件,手动新建即可。

  • Mac位置 ~/.cargo/config

  • Win位置 C:\Users\你的PC名\.cargo\config

配置文件内容如下【二选一】

[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
[source.crates-io]
replace-with = 'rsproxy'
[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配置国内源,解决安装依赖慢问题

Rust配置国内源,解决安装依赖慢问题(备用地址)

点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部