Microsoft ... The technological locomotive of our time. It's no secret that they are cool, and also that they absorb more and more ...
For software developers, they also do not skimp. C #, Azure, Visual Studio ... But now we will talk about Python , because for him a place here was also warmed.
Briefly about WSL
With the Windows update, it became possible to use such a thing as WSL (Windows Subsystem for Linux). Not so long ago, WSL2 appeared with VERY cool modifications. WSL2 uses the latest and newest virtualization technology to run the Linux kernel inside a simplified utility virtual machine. This means that attributes such as isolation and slowdown are missing.
Linux or Linux
Sooner or later, the developer decides in which environment to develop, and this, no matter how, is a very, very important point. An important role is played by the operating system on which the code runs. After all, it is not only a compiler or interpreter, but also services that work in a close and friendly circle. And the core of this OS is responsible for the correct operation of these combat units. It will be about Windows and Linux. And this is not from the category IT is better, but IT is worse, because the choice of an editor or a system is no more than a matter of taste in our time. EVERYTHING today provides a ton of tools to implement something. The reason I prefer Linux is flexibility. Unfortunately, not all Python add-ons work on the brainchild of Microsoft. For example: celery / redis, git, working with local web servers, docker .... I think those who worked at least faced with this “some difficulties”. Therefore, I think that for any Python programmer working with Linux (MacOS), to put it mildly, is necessary ...
Beginning of work
And so you set the flag in the components of Windows,
and downloaded your favorite distribution from the official store.
.
After the simplest manipulations of creating a user, you get access to the Linux terminal. Nothing unusual, if not taken into account, then that the file systems of both OSs are not isolated from each other, as a result of which it becomes possible to manipulate the Windows file system from under Linux. All logical partitions are available at the mount point.
/mnt/c/Program Files/
Development
Now we proceed directly to the development. When choosing an editor, I would stay with Visual Studio Code . It includes a lot of tools, including a debugger, which makes it a full-fledged IDE. Creating a virtual environment on different systems is different. For example, after applying the command
python -m venv venv
a .bat activator and python.exe file are created on Windows, which will be used while Linux copies the python binary system. VS Code is quite flexible with extensions.
Ctrl + Shift + Xallow you to quickly jump to add-ons. In the search, enter WSL and download the first extension from the list.
For convenient development, it is worth adding Python, Git History, Django ... And then what the soul wants.
After that, boldly restart the editor, after which you can open your project
File -> Open FolderAfter loading, pay attention to the lower left corner of the screen.
This will reopen the folder using WSL
The difference is that VS Code in this case switches to the Linux kernel, which is the bottom layer of the Windows kernel. This will allow you to use the desired interpreter, as well as the terminal directly from the editor.
You can also use Windows Terminal. This will significantly increase work efficiency, since WSL is also integrated into it.
In a complex, all this ensures comfortable work on Windows with Linux capabilities. And also the predominant factor is that the working environment has access to the main system, but is isolated from it by the kernel and the base file system.