安装
2021-05-09 11:43 作者:707才不会沉迷B站 | 我要投稿
开始编程前肯定要先安装编译器,Rust提供了rustup命令行工具来安装。
Unix-like
Linux和Mac系统可以通过shell脚本安装:
$ curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh
如果要在Rust中调用C语言,那还需要安装C语言链接器,通常应该是不需要的。
Windows
Win下载exe安装包安装,不过有依赖,需要安装C++ build tools,我一般装最新版。
如果要在内网安装可以下载独立版本,不联网就可以安装 https://forge.rust-lang.org/infra/other-installation-methods.html#standalone
更新
$ rustup update
卸载
$ rustup self uninstall
验证
通过查看版本可以确认安装是否成功,和其他语言检查方法类似
$ rustc --version
安装好后还会带本地文档,官方提供了非常丰富的文档,可以通过下面命令直接打开
$ rustup doc