Rust配置国内源,解决安装依赖慢问题
国内源使用字节的RsProxy https://rsproxy.cn/
配置环境变量
Mac
export RUSTUP_DIST_SERVER="https://rsproxy.cn" export RUSTUP_UPDATE_ROOT="https://rsproxy.cn/rustup"
Windows
创建下面的系统环境变量
-
变量
RUSTUP_DIST_SERVER
,值https://rsproxy.cn
-
变量
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
原文链接

作者:LiangSenCheng小森森 开源分享汇 公众号
出处:https://www.cnblogs.com/LiangSenCheng/p/18329857/rust-proxy-turbo
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。如有问题或建议请联系作者,非常感谢。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!