Reputation: 25
I installed WSL2 and use Visual Studio (VS) 2022 on the windows. I want to configure my VS 2022, so I can develop Python projects in WLS2. All tutorials I find online only talks about visual studio code. I don't want to install another IDE. Does anybody know how to do that or point me to some material?
Upvotes: 2
Views: 2057
Reputation: 1
Answering this late because there is a workaround possible if you want to use Visual Studio debugging tools with Python and WSL2.
You cannot natively run WSL2 Python projects in Visual Studio, but you can run your Python code in WSL2 with debugpy, attach it as a "remote" process in the "debug->Attach to Process" section, and then debug in Visual Studio. Make sure you have identical copies of your files and folder structure in WSL2 and your Visual Studio Python project. See this guide for more details:
Upvotes: 0
Reputation: 127
Not sure if VS is available for Linux or WSL2 yet.
If you look at https://visualstudio.microsoft.com/downloads/, only Windows & Mac seem to be supported.
So you have 2 main options:
EDIT: It may be that I'm misunderstanding the question as pointed out below by NotTheDr01ds, and instead you want to target WSL2 from the VS IDE, developing Python.
Upvotes: 0
Reputation: 20630
Unfortunately not at this time, no. The VSCode integration with WSL is done through the use of an extension that creates an interop server between Windows VSCode and the Linux side of WSL. There isn't an extension like that for Visual Studio, however.
The only WSL integration that I'm aware of in Visual Studio 2022 is the inclusion of a WSL toolchain that allows you to target WSL/Linux in C++ projects. But nothing that I'm aware of for Python, no.
I believe you'll need to install an additional IDE to get Python/WSL support, sorry.
Upvotes: 1