我们如何完全移除Ubuntu安装的Rust ?



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

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。

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

sudo apt remove cargo
sudo apt autoremove

完成后,您应该能够正常运行rustup安装脚本:

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

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

最新更新