rust的版本、安裝、下載問題
rust版本問題,
在使用rust的時候,應用rust的包,有時候包的使用和rust版本有關系。
error: failed to run custom build command for `pear_codegen v0.1.2`
Caused by:
process didn't exit successfully: `D:\rust_lang\rocket1\target\debug\build\pear_codegen-88042941b77438f7\build-script-build` (exit code: 101)
--- stderr
Error: Pear requires a nightly or dev version of Rust.
Installed version is: 1.41.1 (2020-02-24). Minimum required: 1.31.0-nightly (2018-10-05).
thread 'main' panicked at 'Aborting compilation due to incompatible compiler.', C:\Users\Administrator\.cargo\registry\src\github.com-1ecc6299db9ec823\pear_codegen-0.1.2\build.rs:31:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
warning: build failed, waiting for other jobs to finish...
error: build failed
++++++++++++
D:\rust_lang\rocket1>rustup show
Default host: x86_64-pc-windows-msvc
rustup home: C:\Users\Administrator\.rustup
stable-x86_64-pc-windows-msvc (default)
rustc 1.41.1 (f3e1a954d 2020-02-24)
安裝rustup,這個也是官網推薦安裝的。
下載之后,得到一個文件,
rustup-init.exe
文件大小:8.2Mb
下載的并不是rustc編譯器,
我前面文章里面講入門rust的時候,我安裝的是一個msi
是離線安裝的。
rustup下載后,是在線安裝的。
如果發現你電腦里面有rust
就會提示
error
如果你還想安裝,
要么卸載原來的rust
要么rustup --y
帶個參數,就可以安裝了。
之后,在終端就會出現
info downloading...
building。。。
下載了cargo,rustc,rustdoc等工具。
然后在cmd輸入rustup show
可以查看。
D:\rust_lang\rocket1>rustup show
Default host: x86_64-pc-windows-msvc
rustup home: C:\Users\Administrator\.rustup
stable-x86_64-pc-windows-msvc (default)
rustc 1.41.1 (f3e1a954d 2020-02-24)
rust版本:
stable
dev
nighitly
rustup的作用是什么?
DISCUSSION:
rustup installs The Rust Programming Language from the official
release channels, enabling you to easily?switch between stable,
beta,?and nightly?compilers and keep them updated. It makes
cross-compiling simpler with binary builds of the standard library
for common platforms.
If you are new to Rust consider running `rustup doc --book` to
learn Rust.
入門網站:
https://www.rust-lang.org/learn/get-started?www.rust-lang.org/learn/get-started?編輯
rustup怎么使用:
參考
rust-lang/rustup?github.com/rust-lang/rustup/blob/master/README.md?編輯
rustup
?is a?toolchain multiplexer. It installs and manages many Rust toolchains and presents them all through a single set of tools installed to?~/.cargo/bin
. The?rustc
?and?cargo
?installed to?~/.cargo/bin
?are?proxies?that delegate to the real toolchain.?rustup
?then provides mechanisms to easily change the active toolchain by reconfiguring the behavior of the proxies.
So when?rustup
?is first installed running?rustc
?will run the proxy in?$HOME/.cargo/bin/rustc
, which in turn will run the stable compiler. If you later?change the default toolchain?to nightly with?rustup default nightly
, then that same proxy will run the?nightly
?compiler instead.
This is similar to Ruby's?rbenv, Python's?pyenv, or Node's?nvm.
輸入命令
rustup default nightly
然后在終端看到在下載東西。
info:syncing channel updates for 'nightly-x86_64-pc-windows-msvc'
info:latest update on 2020-03-11, rust version 1.43.0-nightly
info:downloading component 'cargo'
info:Retrying download for?https://static.rust-lang.org/dist/2020-03-11/cargo-nightly-x86_64-pc-windows-msvc.tar.xz
這個網站上有很多東西:
地址:
https://static.rust-lang.org/dist/2020-03-11/
cargo
clippy
rust-docs
rust-std
rustc
rustfmt
info:downloading
info:installing
現在電腦上有2個版本。
C:\Users\Administrator\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\bin
C:\Users\Administrator\.rustup\toolchains
目錄下有
nightly-x86_64-pc-windows-msvc
stable-x86_64-pc-windows-msvc
總結:
要按照rust的包,比如rocket的時候,發現了版本問題。
于是,需要用一個新版本的rust
所以,下載了rustup
我保留了2個版本。