1. 安装和配置 WSL 与 Ubuntu
-
启用 WSL 功能(以管理员身份运行 PowerShell):
wsl --install
或手动启用:
dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
-
设置 WSL 2 为默认版本:
wsl --set-default-version 2
-
从 Microsoft Store 安装 Ubuntu(推荐 LTS 版本)
-
如何查看 WSL 是 WSL 1 还是 WSL 2
要确定您的 Windows Subsystem for Linux(WSL)是 WSL 1 还是 WSL 2,可以使用以下方法:
使用命令行
打开 Windows 命令提示符或 PowerShell 终端,并