当前位置:   article > 正文

Rust 安装_cannot install while rust is installed

cannot install while rust is installed

1,Rust 安装

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  • 1
$ source $HOME/.cargo/env
$ rustc --version
rustc 1.37.0 (eae3437df 2019-08-13)
  • 1
  • 2
  • 3

2,国内安装

# export RUSTUP_DIST_SERVER=https://mirrors.ustc.edu.cn/rust-static
# export RUSTUP_UPDATE_ROOT=https://mirrors.ustc.edu.cn/rust-static/rustup
# curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# source $HOME/.cargo/env
# rustc --version
rustc 1.42.0 (b8cedc004 2020-03-09)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

3,macos安装rust

$ brew install rust
  • 1
  • 更新
brew upgrade golang
  • 1

4,macos vscode

  • Rust (rls)
    在这里插入图片描述
  • CodeLLDB
    在这里插入图片描述
$ rustc --version
rustc 1.37.0 (eae3437df 2019-08-13)
$ rustup component add rls rust-analysis rust-src
info: downloading component 'rls'
  6.0 MiB /   6.0 MiB (100 %) 211.2 KiB/s in 37s ETA:  0s
info: installing component 'rls'
info: component 'rust-analysis' for target 'x86_64-apple-darwin' is up to date
info: downloading component 'rust-src'
  2.5 MiB /   2.5 MiB (100 %) 236.8 KiB/s in 13s ETA:  0s
info: installing component 'rust-src'
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • crates
    在这里插入图片描述
  • TOML
    在这里插入图片描述

5,ubuntu安装rust

  • 安装报错
# curl https://sh.rustup.rs -sSf | sh
info: downloading installer
error: it looks like you have an existing installation of Rust at:
error: /usr/bin
error: rustup should not be installed alongside Rust. Please uninstall your existing Rust first.
error: Otherwise you may have confusion unless you are careful with your PATH
error: If you are sure that you want both rustup and your already installed Rust
error: then please restart the installation and pass `-y' to bypass this check.
error: cannot install while Rust is installed
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 加参数-y
curl https://sh.rustup.rs -sSf | sh -s -- -y
  • 1
  • 安装成功
# source $HOME/.cargo/env
# rustc --version
rustc 1.43.1 (8d69840ab 2020-05-04)
# rust
rustc      rustdoc    rustfmt    rust-gdb   rust-lldb  rustup
  • 1
  • 2
  • 3
  • 4
  • 5

6,rust卸载

rustup self uninstall
  • 1

参考:

  1. 安装 Rust
  2. Rust Toolchain 反向代理使用帮助
  3. 如何用VSCode调试Rust(译)
  4. macOS 安装 Rust 开发环境
  5. Other Rust Installation Methods
  6. 卸载 Rust 环境
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/484687
推荐阅读
相关标签
  

闽ICP备14008679号