;

LiangSenCheng博客

接受小程序定制「包括但不限于课设、毕设等,急单不接、二手单不接」

Rust配置国内源,解决安装依赖慢问题

国内源使用字节的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配置国内源,解决安装依赖慢问题

posted @   LiangSenCheng小森森  阅读(254)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!

文章目录[-]返回顶部

  1. 配置环境变量
  2. 添加配置
  3. 原文链接
点击右上角即可分享
微信分享提示