我可以随时在 WSL 版本之间切换吗? [英] Is it okay to switch between WSL versions whenever I need to?
问题描述
我最近刚刚安装了适用于 Linux 2 的 Windows 子系统.我目前唯一的发行版是 Ubuntu,我所做的一切都在使用它.我知道 WSL 1 更适合处理与 Windows 和 Linux 交互的项目,而 WSL 2 更适合仅针对 Linux 的项目.
I just recently installed Windows Subsystem for Linux 2. My only current Distro is Ubuntu and I'm using it for everything I do. I know that WSL 1 is better to handle projects that interact with both Windows and Linux, while WSL 2 is better for projects specific to Linux only.
我可能想根据我正在处理的内容在版本之间切换,我想在版本之间连续切换是否安全?
I might want to switch between the versions depending on what I'm working on, and I would like to if it's safe to continuously change between versions?
我发现的另一种选择是做类似的事情:
Another alternative I found was doing something like:
wsl --export Ubuntu ubuntu.tar
wsl --import Ubuntu2 ./Ubuntu2 ubuntu.tar
然后用wsl --set-version Ubuntu2 2
设置第二个的版本.
and then setting the version of the second one with wsl --set-version Ubuntu2 2
.
推荐答案
基于此 常见问题解答:
我们目前没有弃用 WSL 1 的计划.您可以同时运行 WSL 1 和 WSL 2 发行版,并且可以随时升级和降级任何发行版.
We currently have no plans to deprecate WSL 1. You can run WSL 1 and WSL 2 distros side by side, and can upgrade and downgrade any distro at any time.
话虽如此,从一个切换到另一个被描述为转换",因此我建议您在来回切换时备份重要文件(无论如何通常是个好主意).
That being said, the switch from one to the other is described as a "conversion", so I would suggest have backups of important files when you switch back and forth (generally a good idea anyway).
这篇关于我可以随时在 WSL 版本之间切换吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!