如何在防火墙后面的Windows上使用rustup安装Rust?

Pet*_*Guo 12 proxy rust

下载了rustup-init.exe.当我在家里运行时,一切都很顺利,但当我通过代理从我的办公室运行时,我遇到了一个问题:

info: syncing channel updates for 'stable-x86_64-pc-windows-msvc'
error: could not download file from 'https://static.rust-lang.org/dist/channel-rust-stable.toml.sha256' to 'C:\Users\350627\.rustup\tmp\l3ogei4e89gnb1df_file
info: caused by: error during download
info: caused by: [6] Couldn't resolve host name (Couldn't resolve host 'static.rust-lang.org')
Run Code Online (Sandbox Code Playgroud)

我在Windows上并且http_proxy环境变量已正确设置.

我试图"自定义安装",但它没有给我手动提供IP地址的选项:

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
Run Code Online (Sandbox Code Playgroud)

有没有人知道解决方法?

Jim*_*ger 18

我遵循了一个Spex的建议......

  1. 转到https://www.rust-lang.org/ - >安装
  2. 将rustup-init.exe下载到〜/ Downloads

  3. 在powershell中:

    $proxy='http://<IP>:<PORT>'
    
    $ENV:HTTP_PROXY=$proxy 
    $ENV:HTTPS_PROXY=$proxy
    cd ~\Downloads
    .\rustup-init.exe
    
    Run Code Online (Sandbox Code Playgroud)

  • 这对于其他应用程序也非常有用。谢谢你! (2认同)

Pet*_*Guo 7

我已经测试了上面提到的两个解决方案,并且都有效.谢谢,kennytm和ljedrz!

  1. 建议由kennytm,将以下行添加到c:\ Windows\System32\drivers\etc中的hosts文件

    13.32.244.72 static.rust-lang.org

  2. 由ljedrz建议,使用独立安装程序.在过去,人们可以很容易地找到那些独立的安装程序,但是对于防锈语言站点的最新重组,最初唯一真正弹出的是rustup-init.exe.然而正如@ljedrz在上面的评论中指出的那样,这些独立的安装程序仍然存在,可以在这里找到:各种平台的独立安装程序.

  • 您是否尝试过设置环境变量 `https_proxy=http://xxxx:port`?在那之后生锈开始为我工作。 (2认同)