RUST成长之路1_环境安装

step1. 安装环境

rust安装还是挺简单的, 一条命令搞定

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

请在终端中运行以下命令,然后遵循屏幕上的指示操作即可。
安装完成后, 会有个~/.cargo/bin文件目录

step2. 查看是否安装成功

执行如下命令

~/.cargo/bin/rustc --version

成功如图所示 :
在这里插入图片描述

step3. 配置环境变量

在 Rust 开发环境中,所有工具都安装在 ~/.cargo/bin 目录中,您可以在这里找到包括 rustc、cargo 和 rustup 在内的 Rust 工具链。

以mac环境为例, 执行如下命令:

vi ~/.bash_profile

找到export PATH="******:$PATH"这一行,将$HOME/.cargo/bin 添加其中, 如下:

export PATH="$HOME/.cargo/bin:$PATH"

执行source ./.bash_profile,让环境变量生效, 如下:

source ./.bash_profile

成功后执行rustc --version,如果可以现实版本信息, 则说明环境变量配置成功

rustc --version

猜你喜欢

转载自blog.csdn.net/ERIC_TWELL/article/details/106816185