报错:warning: be sure to add `/root/.cargo/bin` to your PATH to be able to run the installed binarie

warning: be sure to add `/root/.cargo/bin` to your PATH to be able to run the installed binarie

这个警告提示你需要将 Rust 安装路径 /root/.cargo/bin 添加到系统的 PATH 环境变量中,以便能够直接运行安装的 Rust 工具和可执行文件。

解决方法:

  1. 打开终端。

  2. 编辑你的 shell 配置文件(例如 ~/.bashrc~/.zshrc 或者 ~/.bash_profile,取决于你使用的 shell):

    • 对于 bash 用户,通常是 ~/.bashrc
    • 对于 zsh 用户,通常是 ~/.zshrc

    你可以用以下命令打开文件:

    nano ~/.bashrc
  3. 在文件的末尾添加以下行,将 /root/.cargo/bin 路径添加到 PATH 环境变量中:

    export PATH="$HOME/.cargo/bin:$PATH"

    注意:如果你的 Rust 安装路径是 /root/.cargo/bin,你可能需要修改为相应的路径(如果你在根用户下运行)。如果是当前用户的话,$HOME/.cargo/bin 是推荐的路径。

猜你喜欢

转载自blog.csdn.net/jhgj56/article/details/144986721
今日推荐