简体   繁体   English

我们如何才能完全删除 Ubuntu 安装的 Rust?

[英]How can we completely remove Rust installed by Ubuntu?

I want to update my Rust to latest but when I searched for rustup it was not showing up in my system rustup: command not found .我想将我的 Rust 更新到最新版本,但是当我搜索rustup时,它没有出现在我的系统中rustup: command not found I tried to install rustup using curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh我尝试使用curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh安装 rustup curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh . curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh It gave this warning.它发出了这个警告。

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

I tried to remove rustc with sudo apt remove rustc but it returns我尝试使用sudo apt remove rustc rustc它返回

Package 'rustc' is not installed, so not removed

although I can access rustc from terminal.虽然我可以从终端访问rustc My current rustc and cargo version is 1.47.0.我当前的rustccargo版本是 1.47.0。

You can do this without manually deleting the old rust binaries by uninstalling cargo and then auto-removing its now un-needed dependencies:您可以通过卸载 cargo 然后自动删除其现在不需要的依赖项来手动删除旧的 rust 二进制文件:

sudo apt remove cargo
sudo apt autoremove

After that completes, you should be able to run the rustup installation script normally:完成后,您应该能够正常运行rustup安装脚本:

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

Remember that you may need to restart your shell or logout before your system PATH will be updated to include the new binaries.请记住,您可能需要重新启动 shell 或注销,然后系统PATH才会更新以包含新的二进制文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM