Windows Linux子系统使用rustup从新安装Rust

在Windows的Linux子系统上安装Rust,习惯性的用了sudo apt install cargo。结果发现所有安装以后的Rust并非最新版本。想要用Rust官方提供的脚本安装最新版本却出现错误:git

error: it looks like you have an existing installation of Rust at:
error: /mnt/g/
error: rustup cannot be installed alongside Rust. Please uninstall first
error: if this is what you want, restart the installation with `-y'
error: cannot install while Rust is installed

网上不少答案说删除安装的rustc就能够了,结果发现依然失败。最后终于在GitHub issue里找到一个能够用的方法github

如何在Ubuntu中解决Rust重装

  1. 删除安装的rustcide

    sudo apt-get -y remove rustc cargo
    	sudo apt -y autoremove
  2. 下载自动安装脚本 https://sh.rustup.rsthis

  3. 命令行中运行命令行

    RUSTUP_INIT_SKIP_PATH_CHECK=yes sh ./rustup-init.sh
相关文章
相关标签/搜索