美文网首页
rust 安装

rust 安装

作者: 戈壁堂 | 来源:发表于2021-05-27 19:37 被阅读0次

    安装完成后,.cargo/bin目录包含所有的工具——

    • rustup管理rust工具本身:rustup是一个the rust toolchain installer 用来安装rust以及对于的工具组件。更详细内容参考rustup book
    • rustc相当于类似gcc的编译器,单个文件编译
    • Cargo 是 rust 的构建系统和包管理器,相当于工程抓手

    rust 安装

    • Windows: 下载rusti-init.ext进行安装,默认选项,安装完毕就可以使用
    • 类Unix平台:执行curl https://sh.rustup.rs -sSf | sh
    ➜  ~ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    info: downloading installer
    
    Welcome to Rust!
    
    This will download and install the official compiler for the Rust
    programming language, and its package manager, Cargo.
    
    Rustup metadata and toolchains will be installed into the Rustup
    home directory, located at:
    
      /Users/gebitang/.rustup
    
    This can be modified with the RUSTUP_HOME environment variable.
    
    The Cargo home directory located at:
    
      /Users/gebitang/.cargo
    
    This can be modified with the CARGO_HOME environment variable.
    
    The cargo, rustc, rustup and other commands will be added to
    Cargo's bin directory, located at:
    
      /Users/gebitang/.cargo/bin
    
    This path will then be added to your PATH environment variable by
    modifying the profile files located at:
    
      /Users/gebitang/.profile
      /Users/gebitang/.bash_profile
      /Users/gebitang/.zshenv
    
    You can uninstall at any time with rustup self uninstall and
    these changes will be reverted.
    
    Current installation options:
    
    
       default host triple: x86_64-apple-darwin
         default toolchain: stable (default)
                   profile: default
      modify PATH variable: yes
    
    1) Proceed with installation (default)
    2) Customize installation
    3) Cancel installation
    >1
    
    info: profile set to 'default'
    info: default host triple is x86_64-apple-darwin
    info: syncing channel updates for 'stable-x86_64-apple-darwin'
    672.7 KiB / 672.7 KiB (100 %) 422.6 KiB/s in  1s ETA:  0s
    info: latest update on 2021-05-10, rust version 1.52.1 (9bc8c42bb 2021-05-09)
    info: downloading component 'cargo'
      4.3 MiB /   4.3 MiB (100 %)   1.4 MiB/s in  3s ETA:  0s
    info: downloading component 'clippy'
      1.7 MiB /   1.7 MiB (100 %)   1.6 MiB/s in  1s ETA:  0s
    info: downloading component 'rust-docs'
     15.3 MiB /  15.3 MiB (100 %)   1.9 MiB/s in  8s ETA:  0s
    info: downloading component 'rust-std'
     23.0 MiB /  23.0 MiB (100 %)   1.9 MiB/s in 13s ETA:  0s
    info: downloading component 'rustc'
     58.6 MiB /  58.6 MiB (100 %)   1.9 MiB/s in 32s ETA:  0s
    info: downloading component 'rustfmt'
      2.3 MiB /   2.3 MiB (100 %)   1.2 MiB/s in  1s ETA:  0s
    info: installing component 'cargo'
    info: installing component 'clippy'
    info: installing component 'rust-docs'
     15.3 MiB /  15.3 MiB (100 %)   5.0 MiB/s in  2s ETA:  0s
    info: installing component 'rust-std'
     23.0 MiB /  23.0 MiB (100 %)  11.1 MiB/s in  5s ETA:  0s
    info: installing component 'rustc'
     58.6 MiB /  58.6 MiB (100 %)  13.8 MiB/s in  4s ETA:  0s
    info: installing component 'rustfmt'
    info: default toolchain set to 'stable-x86_64-apple-darwin'
    
      stable-x86_64-apple-darwin installed - rustc 1.52.1 (9bc8c42bb 2021-05-09)
    
    
    Rust is installed now. Great!
    
    To get started you may need to restart your current shell.
    This would reload your PATH environment variable to include
    Cargo's bin directory ($HOME/.cargo/bin).
    
    To configure your current shell, run:
    source $HOME/.cargo/env
    

    验证

    rustc --versioncargo --verson, rustup --version

    卸载操作:rustup self uninstall

    相关文章

      网友评论

          本文标题:rust 安装

          本文链接:https://www.haomeiwen.com/subject/amddsltx.html