启用“虚拟机平台”可选组件Enable the 'Virtual Machine Platform' optional component

启用这些更改后，需要重新启动计算机。After these changes are enabled you will need to restart your computer.

使用命令行设置要由 WSL 2 支持的发行版Set a distro to be backed by WSL 2 using the command line

在 PowerShell 中运行：In PowerShell run:

wsl --set-version <Distro> 2

并且确保将 <Distro> 替换为你的发行版的实际名称。and make sure to replace <Distro> with the actual name of your distro.（可使用以下命令找到这些内容：wsl -l）。(You can find these with the command: wsl -l).可以随时更改回 WSL 1，方法是运行与上面相同的命令，但将“2”替换为“1”。You can change back to WSL 1 at anytime by running the same command as above but replacing the '2' with a '1'.

此外，如果要使 WSL 2 成为你的默认体系结构，可以通过此命令执行该操作：Additionally, if you want to make WSL 2 your default architecture you can do so with this command:

wsl --set-default-version 2

这会使你安装的任何新发行版均初始化为 WSL 2 发行版。This will make any new distro that you install be initialized as a WSL 2 distro.

完成验证发行版使用的 WSL 版本Finish with verifying what versions of WSL your distro are using

若要验证每个发行版使用的 WSL 版本，请使用以下命令：To verify what versions of WSL each distro is using use the following command:

wsl --list --verbose 或 wsl -l -vwsl --list --verbose or wsl -l -v

上面选择的发行版现在应在“version”列下显示“2”。The distro that you've chosen above should now display a '2' under the 'version' column.既然已经完成，便可以随时开始使用 WSL 2 发行版了！Now that you're finished feel free to start using your WSL 2 distro!

疑难解答：Troubleshooting:

下面是安装 WSL 2 时的相关错误和建议的修补程序。Below are related errors and suggested fixes when installing WSL 2.请参阅 WSL 故障排除页以了解其他常见的 WSL 错误及其解决方案。Please refer to the WSL troubleshooting page for other general WSL errors and their solutions.

请确保在计算机的 BIOS 内已启用虚拟化。Please make sure that virtualization is enabled inside of your computer's BIOS.有关如何执行此操作的说明因计算机而异，并且很可能在 CPU 相关选项下。The instructions on how to do this will vary from computer to computer, and will most likely be under CPU related options.