如何移动RUST工具的安装目录?

1l5u6lss  于 2023-11-19  发布在  其他
关注(0)|答案(1)|浏览(207)

我错误地将RUST安装在我的“src”树中。它可以工作,但我想将它移动到我本地AppData目录下的某个地方,如“%LOCALAPPDATA%\Rust”或“%LOCALAPPDATA%\Rust\Stable”。我看不到“rustup”的“self”或“update”选项中有这样的选项。是否有这样的选项,或者我做一个完全卸载并重新安装?我 * 认为 * documentation意味着我可以在安装RUST之前设置“RUSTUP_HOME”和“CARGO_HOME”环境变量,这将导致“rustup”或安装程序将可执行文件放入“%CARGO_HOME%\bin”。我阅读对了吗?
版本信息:

C:\>rustup --version
rustup 1.26.0 (5af9b9484 2023-04-05)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.73.0 (cc66ad468 2023-10-03)`

字符串
环境变量:

C:\Users\*JOE_USER*>echo "%CARGO_HOME%" && echo "%RUSTUP_HOME%"
"C:\Users\*JOE_USER*\OneDrive\Documents\Src\.cargo"
"C:\Users\*JOE_USER*\OneDrive\Documents\Src\.rustup"


以下是多个重命名版本的“RUSTUP”:

Directory of C:\Users\*JOE_USER*\OneDrive\Documents\Src\.cargo\bin

08/11/2023  09:38 PM    <DIR>          .
03/01/2023  10:06 AM    <DIR>          ..
08/11/2023  08:57 PM         8,594,944 cargo-clippy.exe
08/11/2023  08:57 PM         8,594,944 cargo-fmt.exe
08/11/2023  08:57 PM         8,594,944 cargo-miri.exe
08/11/2023  08:57 PM         8,594,944 cargo.exe
08/11/2023  08:57 PM         8,594,944 clippy-driver.exe
08/11/2023  08:57 PM         8,594,944 rls.exe
08/11/2023  08:57 PM         8,594,944 rust-analyzer.exe
08/11/2023  08:57 PM         8,594,944 rust-gdb.exe
08/11/2023  08:57 PM         8,594,944 rust-gdbgui.exe
08/11/2023  08:57 PM         8,594,944 rust-lldb.exe
08/11/2023  08:57 PM         8,594,944 rustc.exe
08/11/2023  08:57 PM         8,594,944 rustdoc.exe
08/11/2023  08:57 PM         8,594,944 rustfmt.exe
08/11/2023  08:57 PM         8,594,944 rustup.exe


下面是实际的可执行文件:

Directory of C:\Users\*JOE_USER*\OneDrive\Documents\Src\.rustup\toolchains\stable-x86_64-pc-windows-msvc\bin

10/16/2023  02:51 PM        22,269,440 cargo.exe
10/16/2023  02:51 PM         9,035,776 clippy-driver.exe
10/16/2023  02:51 PM           770,048 cargo-clippy.exe
10/16/2023  02:52 PM         4,706,304 test-bdd24cd8003a6271.pdb
10/16/2023  02:52 PM         6,868,992 std-287abad1c0bdb9b8.pdb
10/16/2023  02:52 PM        60,534,784 rustc_driver-ecc82c9d925511c8.pdb
10/16/2023  02:52 PM               265 rust-windbg.cmd
10/16/2023  02:52 PM         3,575,808 rustc_main-0b34c7ab06f9785c.pdb
10/16/2023  02:52 PM           112,128 rustc.exe
10/16/2023  02:52 PM         8,693,248 rustdoc.exe
10/16/2023  02:52 PM         1,699,328 test-bdd24cd8003a6271.dll
10/16/2023  02:52 PM        11,128,320 std-287abad1c0bdb9b8.dll
10/16/2023  02:52 PM       133,861,888 rustc_driver-ecc82c9d925511c8.dll
10/16/2023  02:52 PM    <DIR>          ..
10/16/2023  02:52 PM         1,354,240 cargo-fmt.exe
10/16/2023  02:52 PM         5,092,352 rustfmt.exe
10/16/2023  02:52 PM    <DIR>          .

qacovj5a

qacovj5a1#

您可以移动.cargo.rustup目录并相应地设置RUSTUP_HOMECARGO_HOME。您可能还需要调整PATH和类似的变量。

相关问题