Answer

问题及解答

Windows 安装 WSL 及 WSL2

Posted by haifeng on 2021-03-10 16:36:43 last update 2021-03-10 16:44:10 | Edit | Answers (0)

使用管理员打开 PowerShell

输入下面的命令 

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart


Windows PowerShell
版权所有 (C) Microsoft Corporation。保留所有权利。
尝试新的跨平台 PowerShell https://aka.ms/pscore6
PS C:\Windows\system32> dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
部署映像服务和管理工具
版本: 10.0.18362.1379
映像版本: 10.0.18363.1379
启用一个或多个功能
[==========================100.0%==========================]
操作成功完成。
PS C:\Windows\system32>

Remark:  /norestart  表示不重启 (no restart)

在安装 WSL 2 之前, 必须启用“虚拟机平台”可选功能

PS C:\Windows\system32> dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
部署映像服务和管理工具
版本: 10.0.18362.1379
映像版本: 10.0.18363.1379
启用一个或多个功能
[==========================100.0%==========================]
操作成功完成。

 

References:

https://zhuanlan.zhihu.com/p/224753478