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

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

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

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里找到一个可以用的方法。

如何在Ubuntu中解决Rust重装

  1. 删除安装的rustc

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

  3. 命令行中运行

    	RUSTUP_INIT_SKIP_PATH_CHECK=yes sh ./rustup-init.sh
    

转载于:https://my.oschina.net/yushulx/blog/3043452

你可能感兴趣的:(Windows Linux子系统使用rustup重新安装Rust)