在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
刪除安裝的rustc
ide
sudo apt-get -y remove rustc cargo sudo apt -y autoremove
下載自動安裝腳本 https://sh.rustup.rsthis
命令行中運行命令行
RUSTUP_INIT_SKIP_PATH_CHECK=yes sh ./rustup-init.sh