我试图使用推荐的安装脚本在Raspberrypi 4上安装rust:
pi@raspberrypi:/tmp $ curl https://sh.rustup.rs -sSf | sh
但重新启动后,找不到cargo
:
pi@raspberrypi:~ $ cargo
error: command failed: 'cargo'
error: caused by: No such file or directory (os error 2)
这可能与安装期间报告的(error reading rustc version)
有关(底部的完整安装日志(:
info: default toolchain set to 'stable-aarch64-unknown-linux-gnu'
stable-aarch64-unknown-linux-gnu installed - (error reading rustc version)
以下是完整的安装日志:
pi@raspberrypi:/tmp $ curl https://sh.rustup.rs -sSf | sh
info: downloading installer
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:
/home/pi/.rustup
This can be modified with the RUSTUP_HOME environment variable.
The Cargo home directory located at:
/home/pi/.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:
/home/pi/.cargo/bin
This path will then be added to your PATH environment variable by
modifying the profile files located at:
/home/pi/.profile
/home/pi/.bashrc
You can uninstall at any time with rustup self uninstall and
these changes will be reverted.
Current installation options:
default host triple: aarch64-unknown-linux-gnu
default toolchain: stable (default)
profile: default
modify PATH variable: yes
1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>1
info: profile set to 'default'
info: default host triple is aarch64-unknown-linux-gnu
info: syncing channel updates for 'stable-aarch64-unknown-linux-gnu'
info: latest update on 2021-03-25, rust version 1.51.0 (2fd73fabe 2021-03-23)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'rust-docs'
15.0 MiB / 15.0 MiB (100 %) 6.6 MiB/s in 2s ETA: 0s
info: downloading component 'rust-std'
26.3 MiB / 26.3 MiB (100 %) 10.2 MiB/s in 4s ETA: 0s
info: downloading component 'rustc'
76.9 MiB / 76.9 MiB (100 %) 10.1 MiB/s in 12s ETA: 0s
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: using up to 500.0 MiB of RAM to unpack components
5.3 MiB / 5.3 MiB (100 %) 5.1 MiB/s in 1s ETA: 0s
info: installing component 'clippy'
info: installing component 'rust-docs'
15.0 MiB / 15.0 MiB (100 %) 2.3 MiB/s in 6s ETA: 0s
info: installing component 'rust-std'
26.3 MiB / 26.3 MiB (100 %) 4.5 MiB/s in 9s ETA: 0s
info: installing component 'rustc'
76.9 MiB / 76.9 MiB (100 %) 5.0 MiB/s in 15s ETA: 0s
info: installing component 'rustfmt'
info: default toolchain set to 'stable-aarch64-unknown-linux-gnu'
stable-aarch64-unknown-linux-gnu installed - (error reading rustc version)
Rust is installed now. Great!
To get started you need Cargo's bin directory ($HOME/.cargo/bin) in your PATH
environment variable. Next time you log in this will be done
automatically.
To configure your current shell, run:
source $HOME/.cargo/env
pi@raspberrypi:~ $ cargo
error: command failed: 'cargo'
error: caused by: No such file or directory (os error 2)
nano/home/pi/.profile
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi
source "$HOME/.cargo/env"
也在/home/pi/.bashrc:中
source "$HOME/.cargo/env"
uname-
Linux raspberrypi 5.10.17-v8+ #1403 SMP PREEMPT Mon Feb 22 11:37:54 GMT 2021 aarch64 GNU/Linux
当被要求提供安装选项时,选择2("自定义安装",然后选择";默认主机三重"输入";arm未知linux gneabihf";
它与32位/64位有关。