Are you a Python Developer who wants to develop a program using Visual Studio code but is not sure how to Set-up Python Development Environment in VS code?
Before start creating Python scripts, programs, or any project in Visual Studio code you first have to set up the right tools, environment, and interpreters so you can start coding without any issues.
In this post, we are going to talk about the same thing since this post explains How to set up a Python programming environment in VS Code editor.
How to Set up Python Development Environment in VS code
The Process of setting up the Python Development environment on your VS code editor includes Installing Python on your computer, Installing VS code itself, Installing Python extensions, and setting up an interpreter.
Here are all these steps in more detail –
Install Python on Your Computer
Installing Python is the first step toward starting coding in Python on your Computer.
Python is free and available for almost all devices.
To install Python on any Desktop or Laptop you have to head over to – https://Www.Python.Org/Downloads/
From Python.Org, you can download Python for your Windows, Linux, Unix, macOS, and a few other devices.
Install VS Code (If not installed already)
There is no way you can set up a Python development environment on your MAC or PC without even installing Visual studio code on your computer.
Fortunately VS code is free software and designed to work with almost any programming language which makes it appealing to programmers.
You can Download VS Code from – Https://Code.VisualStudio.Com.
Just download the installer file on your Windows, Linux, or MAC and proceed to install it accordingly.
Install and Set-up necessary Python extensions
Click on the Extention option on Left Sidebar or *Ctrl+Shift+X* to open the Extention option.
Now search for Python in the Search bar. Install the python extension with the id ms-python. python.
There are other essential VS code extensions that you can install as well for programming in Python on your Visual Studio Code.
However, the required extensions would depend on the library you are working with.
For example, there are extensions that contain snippets for Scrapy, Django, Tkinter, and many more.
Just search on the search bar you will find ideal extensions for almost any task on VS Code.
Configure Python interpreter in VS code
When you have installed Python on your computer and set up it with VS code there is no need to set up Interpreter if you are not using any virtual environment.
Most of the time VS code will detect these environments and Python automatically and you can run the program any time by using the Run Python file option on the top right corner.
But when it is not set up automatically you can set up the Python interpreter path in VS code settings manually.
Make sure to pass your Virtual environment path as the address in the right field.
Start development of your Python Program
Once everything is set you can straight up develop your Python Programs there.
Unlike text editor where you have to use Command prompts to run any command, you can use build in Terminal along with the run function.
As for Python files, when you save files “.py” extension, it will treat these as the python script and run them accordingly.