在 Rust 中,默认情况下,文件放在 $HOME/.cargo
和 $HOME/.rustup
中。有什么方法可以覆盖这些默认值吗?
我正在尝试调试一个模糊的问题,我想尝试更改文件位置。
最佳答案
这解释了in the documentation :
rustup
allows you to customise your installation by setting the environment variablesCARGO_HOME
andRUSTUP_HOME
before running therustup-init
executable. As mentioned in the Environment Variables section,RUSTUP_HOME
sets the root rustup folder, which is used for storing installed toolchains and configuration options.CARGO_HOME
contains cache files used by cargo.
不要忘记更新 $PATH
否则您将无法使用二进制文件。此外,如果您希望该设置是永久性的,请从您的 shell 配置中导出这些变量(例如 .bashrc
或 .zshrc
):
Note that you will need to ensure these environment variables are always set and that
CARGO_HOME/bin
is in the$PATH
environment variable when using the toolchain.
关于rust - 覆盖 Rust 安装默认路径 `$HOME/.cargo` 和 `$HOME/.rustup`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57765424/