gpt4 book ai didi

rust - 覆盖 Rust 安装默认路径 `$HOME/.cargo` 和 `$HOME/.rustup`

转载 作者:行者123 更新时间:2023-11-29 08:05:47 29 4
gpt4 key购买 nike

在 Rust 中,默认情况下,文件放在 $HOME/.cargo$HOME/.rustup 中。有什么方法可以覆盖这些默认值吗?

我正在尝试调试一个模糊的问题,我想尝试更改文件位置。

最佳答案

这解释了in the documentation :

rustup allows you to customise your installation by setting the environment variables CARGO_HOME and RUSTUP_HOME before running the rustup-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/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com