rust源配置

  • 打开终端,编辑~/.bash_profile~/.zshrc文件(取决于您使用的Shell)。
  • 添加以下内容来配置Rustup的镜像源。这里以阿里云镜像为例:
  • export RUSTUP_UPDATE_ROOT=https://mirrors.aliyun.com/rustup/rustup
    export RUSTUP_DIST_SERVER=https://mirrors.aliyun.com/rustup
    

      

    • 保存文件并退出编辑器。
    • 使配置生效:source ~/.bash_profile(或source ~/.zshrc
    • 为 Cargo 配置国内镜像

      1. 编辑~/.cargo/config文件(Windows 系统配置文件地址默认为%USERPROFILE%\.cargo\config)。

      2. [source.crates-io]
        replace-with = 'aliyun'
        
        [source.aliyun]
        registry = "sparse+https://mirrors.aliyun.com/crates.io-index/"
        

          

      3. 完成以上步骤后,再次运行rustup update stable  (不要加sudo),应该能够感受到下载速度的提升。如果仍然速度较慢,可以尝试更换其他国内镜像源,如中国科学技术大学(USTC)的镜像源等。

 

posted @ 2025-02-05 16:58  CrossPython  阅读(325)  评论(0)    收藏  举报