How to use Python in the Visual Studio Code in Windows?
Hey Guys, I hope you are in good health during this pandemic. So, Coming to the point, this article is about using Python in Visual Studio Code. Before this, I used Anaconda to code python programs, but it was slow and required a massive space with different types of IDEs like R studio, Spyder, etc. Visual Studio Code is a free source-code editor made by Microsoft for Windows, Linux and macOS. It is a lightweight editor and optimized for building and debugging modern web and cloud applications. You can download it from here.
To Install Visual Studio Code, Follow the Pictures Step by Steps:
Now to install Python. We can download it from Microsoft Store. Follow the steps below:
Now to Configure Python in Visual Studio Code.
- We have to install the python interpreter. After opening the Visual Studio, click on the extensions marked by a red circle, as shown in the picture below.
2. Now, type Python in the space and press enter. Click on the first option, as shown in the picture below.
3. Now click on install.
4. After that, go to the Command Palette. You could either go from View -> Command Palette or press CTRL + Shift+ P on the keyboard. Something like this appears
5. Type Python Interpreter. And select the first option Python: Select Interpreter
6. Select the version you installed.
7. Now, create a new file and save it with the .py extension and start coding. It will work just fine. But if in the terminal, it shows an error or the output is not shown. Then, try selecting the python interpreter again, but from the bottom left corner like the picture below.
That’s it, and your platform is up and running. But if you want to install any library like NumPy or matplotlib, etc., go to Command window and install using pip. You can also go to this video link for a detailed explanation of all Python with visual studio.
I hope you understand. If you face any issues, feel free to drop a comment. Thank you.🤗