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
相關文章
相關標籤/搜索