rust开发环境安装配置(操作系统为win10 64位)
2)安装完后会提示是否启动运行mingw64,选择运行,出现命令窗口的运行界面,输入'pacman -S --noconfirm base-devel mingw-w64-x86_64-toolchain git'回车,会进行安装配置。在https://rustup.rs/或https://www.rust-lang.org/zh-CN/tools/install下载rustup-init.exe
安装rust
1、安装msys2
1)进入下载地址:https://www.msys2.org/下载msys2-x86_64-20250622.exe,点击安装即可
2)安装完后会提示是否启动运行mingw64,选择运行,出现命令窗口的运行界面,输入'pacman -S --noconfirm base-devel mingw-w64-x86_64-toolchain git'回车,会进行安装配置
3)添加 C:\msys64\mingw64\bin 到 Path 环境变量
2、修改系统变量(rust安装时所需的软件会在国内网站下载)
系统属性->环境变量->系统变量中新建
RUSTUP_DIST_SERVER : https://mirrors.ustc.edu.cn/rust-static
RUSTUP_UPDATE_ROOT : https://mirrors.ustc.edu.cn/rust-static/rustup
3、安装rust-int
在https://rustup.rs/或https://www.rust-lang.org/zh-CN/tools/install下载rustup-init.exe
双击rustup-init.exe
Rust Visual C++ prerequisites
Rust requires a linker and Windows API libraries but they don't seem to be
available.
These components can be acquired through a Visual Studio installer.
1) Quick install via the Visual Studio Community installer
(free for individuals, academic uses, and open source).
2) Manually install the prerequisites
(for enterprise and advanced users).
3) Don't install the prerequisites
(if you're targeting the GNU ABI).
>2
You can acquire the build tools by installing Microsoft Visual Studio.
https://visualstudio.microsoft.com/downloads/
Check the box for "Desktop development with C++" which will ensure that the
needed components are installed. If your locale language is not English,
then additionally check the box for English under Language packs.
For more details see:
https://rust-lang.github.io/rustup/installation/windows-msvc.html
Install the C++ build tools before proceeding.
If you will be targeting the GNU ABI or otherwise know what you are
doing then it is fine to continue installation without the build
tools, but otherwise, install the C++ build tools before proceeding.
Continue? (y/N)
y
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:
C:\Users\Administrator\.rustup
This can be modified with the RUSTUP_HOME environment variable.
The Cargo home directory is located at:
C:\Users\Administrator\.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:
C:\Users\Administrator\.cargo\bin
This path will then be added to your PATH environment variable by
modifying the PATH registry key at HKEY_CURRENT_USER\Environment.
You can uninstall at any time with rustup self uninstall and
these changes will be reverted.
Current installation options:
default host triple: x86_64-pc-windows-msvc
default toolchain: stable (default)
profile: default
modify PATH variable: yes
1) Proceed with standard installation (default - just press enter)
2) Customize installation
3) Cancel installation
>2
I'm going to ask you the value of each of these installation options.
You may simply press the Enter key to leave unchanged.
Default host triple? [x86_64-pc-windows-msvc]
x86_64-pc-windows-gnu
Default toolchain? (stable/beta/nightly/none) [stable]
stable
Profile (which tools and data to install)? (minimal/default/complete) [default]
default
Modify PATH variable? (Y/n)
Y
Current installation options:
default host triple: x86_64-pc-windows-gnu
default toolchain: stable
profile: default
modify PATH variable: yes
1) Proceed with selected options (default - just press enter)
2) Customize installation
3) Cancel installation
>1
最后输入1回车,开始下载安装rust
4、查看是否已正常安装
rustup --version
rustup update
rustup show
测试
C:\Users\Administrator>cargo new hello
Creating binary (application) `hello` package
note: see more `Cargo.toml` keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
C:\Users\Administrator>cd hello
C:\Users\Administrator\hello>cargo run
Compiling hello v0.1.0 (C:\Users\Administrator\hello)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.68s
Running `target\debug\hello.exe`
Hello, world!
更多推荐
所有评论(0)