【问题标题】:How can we completely remove Rust installed by Ubuntu?我们如何才能完全删除 Ubuntu 安装的 Rust?
【发布时间】:2021-05-27 18:55:33
【问题描述】:

我想将我的 Rust 更新到最新版本,但是当我搜索 rustup 时,它并没有出现在我的系统 rustup: command not found 中。我尝试使用curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh 安装 rustup。它给出了这个警告。

warning: rustup should not be installed alongside Rust. Please uninstall your existing Rust first.
warning: Otherwise you may have confusion unless you are careful with your PATH
warning: If you are sure that you want both rustup and your already installed Rust
warning: then please reply `y' or `yes' or set RUSTUP_INIT_SKIP_PATH_CHECK to yes

我试图用sudo apt remove rustc 删除rustc,但它返回了

Package 'rustc' is not installed, so not removed

虽然我可以从终端访问rustc。我当前的rustccargo 版本是1.47.0。

【问题讨论】:

  • 如果您使用apt install 安装它,那么问题是它没有被称为rustc 它被称为其他东西。您需要在您的包裹中搜索包含“锈”字样的东西。还有apt remove那个。
  • apt list | grep rust 应该只列出包含单词 rust 的已安装包。
  • apt list | grep rust 显示,rust-doc,rust-gdb,rust-lldb,rust-src,rustc
  • 我想apt list --installed rust 没有显示任何包。这意味着 rust-doc、rust-gdb、rust-lldb、rust-src、rustc... 已安装但不是通过 apt 安装的,因此无法删除它们。
  • 你还记得你是如何安装 rustc 的吗?

标签: ubuntu rust ubuntu-18.04 uninstallation rust-cargo


【解决方案1】:

您可以这样做通过卸载 cargo 然后自动删除它现在不需要的依赖项来手动删除旧的 rust 二进制文件:

sudo apt remove cargo
sudo apt autoremove

完成后,应该可以正常运行rustup安装脚本了:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

请记住,您可能需要重新启动 shell 或注销,然后您的系统 PATH 才会更新以包含新的二进制文件。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-24
    • 2019-10-19
    • 2020-10-18
    • 2012-10-01
    • 2017-11-29
    • 2012-02-03
    相关资源
    最近更新 更多