Rust开发环境安装
在线尝试Rust开发:https://play.rust-lang.org/
一般不直接下载编译器,使用rustup工具安装如rust相关的一整套工具链
安装步骤
在线安装
获取rustup-init
- Window版本:官网下载rustup-init
- Unix使用以下命令进行安装(root用户安装需要添加
-y参数):
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
也可通过以下链接下载对应版本的安装包
- aarch64-linux-android
- aarch64-unknown-linux-gnu
- arm-linux-androideabi
- arm-unknown-linux-gnueabi
- armv7-linux-androideabi
- armv7-unknown-linux-gnueabihf
- i686-apple-darwin
- i686-linux-android
- i686-pc-windows-gnu
- i686-pc-windows-msvc
- i686-unknown-linux-gnu
- mips-unknown-linux-gnu
- mips64-unknown-linux-gnuabi64
- mips64el-unknown-linux-gnuabi64
- mipsel-unknown-linux-gnu
- x86_64-apple-darwin
- x86_64-linux-android
- x86_64-pc-windows-gnu
- x86_64-pc-windows-gnu
- x86_64-pc-windows-msvc
- x86_64-unknown-freebsd
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- x86_64-unknown-netbsd
安装工具
window下直接运行,会弹出命令行;Unix下使用命令行安装会直接弹出提示,使用安装包的可以直接运行./rustup-init
pierce@mobile:~$ ./rustup-init
Welcome to Rust!
This will download and install the official compiler for the Rust
programming language, and its package manager, Cargo.
It will add the cargo, rustc, rustup and other commands to
Cargo bin directory, located at:
/home/casa/.cargo/bin #cargo安装路径
This can be modified with the CARGO_HOME environment variable.
Rustup metadata and toolchains will be installed into the Rustup
home directory, located at:
/home/casa/.rustup #rustup安装路径
This can be modified with the RUSTUP_HOME environment variable.
This path will then be added to your PATH environment variable by
modifying the profile file located at:
/home/casa/.profile #修改PATH环境变量的profile路径
You can uninstall at any time with rustup self uninstall and
these changes will be reverted.
Current installation options:
default host triple: x86_64-unknown-linux-gnu #平台信息
default toolchain: stable #工具链版本(nightly/beta/stable/none)
profile: default #工具链的完整性选取(minimal/default/complete)
modify PATH variable: yes #是否修改PATH环境变量
1) Proceed with installation (default) #安装
2) Customize installation #自定义安装
3) Cancel installation #取消安装
> #<--输入你想要的操作的编号
自定义安装根据提示更改完配置信息,确认后安装即可。
安装工具链
如果安装rustup时toolchain选取为none,或者想要更换rust工具链版本,可使用以下命令安装nightly/beta/stable中任一版本的工具链
$ rustup install nightly/beta/stable
$ rustup default nightly/beta/stable
离线安装
下载对应平台的离线安装包,解压并运行目录下的install.sh即可。
| platform | stable | beta | nightly |
|---|---|---|---|
| aarch64-unknown-linux-gnu | tar.gz | tar.gz | tar.gz |
| arm-unknown-linux-gnueabi | tar.gz | tar.gz | tar.gz |
| arm-unknown-linux-gnueabihf | tar.gz | tar.gz | tar.gz |
| armv7-unknown-linux-gnueabihf | tar.gz | tar.gz | tar.gz |
| i686-apple-darwin | pkg | pkg | pkg |
| i686-pc-windows-gnu | msi | msi | msi |
| i686-pc-windows-msvc | msi | msi | msi |
| i686-unknown-linux-gnu | tar.gz | tar.gz | tar.gz |
| mips-unknown-linux-gnu | tar.gz | tar.gz | tar.gz |
| mips64-unknown-linux-gnuabi64 | tar.gz | tar.gz | tar.gz |
| mips64el-unknown-linux-gnuabi64 | tar.gz | tar.gz | tar.gz |
| mipsel-unknown-linux-gnu | tar.gz | tar.gz | tar.gz |
| powerpc-unknown-linux-gnu | tar.gz | tar.gz | tar.gz |
| powerpc64-unknown-linux-gnu | tar.gz | tar.gz | tar.gz |
| powerpc64le-unknown-linux-gnu | tar.gz | tar.gz | tar.gz |
| s390x-unknown-linux-gnu | tar.gz | tar.gz | tar.gz |
| x86_64-apple-darwin | pkg | pkg | pkg |
| x86_64-pc-windows-gnu | msi | msi | msi |
| x86_64-pc-windows-msvc | msi | msi | msi |
| x86_64-unknown-freebsd | tar.gz | tar.gz | tar.gz |
| x86_64-unknown-linux-gnu | tar.gz | tar.gz | tar.gz |
| x86_64-unknown-linux-musl | tar.gz | tar.gz | tar.gz |
| x86_64-unknown-netbsd | tar.gz | tar.gz | tar.gz |
版权声明:本文为mr_black_man原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。