How to Install and Set Up Python in Visual Studio Code and Run Your First Program

 



If you’re starting your programming journey, Python is one of the best languages to learn. In this step-by-step guide, you’ll learn how to install Python, set it up in Visual Studio Code (VS Code), and run your first Python program successfully.


Step 1: Verify Whether Python Is Installed

First, check if Python is already installed on your system.

1) Open Command Prompt (CMD) on your system.

2) Type the following command and press Enter: python –version


If Python is installed, you’ll see the Python version displayed.

If not, you’ll see a message like “Python was not found” on the CMD screen.

 

Step 2: Download Python

If Python is not installed, follow these steps:

  1. Open Google and search for “Python download.”
  2. Click on the official website:
    https://www.python.org/downloads/
  3. Download the latest version of Python.

Using the official site ensures you get a secure and updated version.




Step 3: Install Python

1) Open the downloaded .exe installer file.

2) Select “Customize Installation” (recommended for better control).

3) Click Next.

4) On the next screen, check all the checkbox options — these features are useful.

5) Go to Advanced Options.

6) Choose the installation location if you want to change it.

7) Click Install.

Once installation is complete, close the setup pop-up.

Python is now installed on your system







Step 4: Verify Python Installation Again

To confirm installation:

1)               Open CMD again.

 Run the command: python –version

If you see the Python version, installation was successful


Step 5: Connect Python with Visual Studio Code

Note: Check out this blog for setup VS code http://www.letsdopython.com/2026/02/how-to-download-and-install-visual.html

Now let’s configure Python in VS Code.

      Open Visual Studio Code.

 Go to the Extensions section.

 Search for Python and install the official Python extension.

 Also install Code Runner.

Why Code Runner?
It helps you run Python code quickly and easily inside VS Code.



That’s awesome!!! You install python and connect python with VS code

Step 6: Create a Project Folder

Before writing code:

            1) Create a new folder anywhere on your system.

 2)  Open that folder in VS Code.

This folder will store all your Python programs.


Step 7: Create Your First Python File

You can create a file in multiple ways:

  • Click New File
  • Press Ctrl + N
  • Go to File → New File

Now save the file with a .py extension.

Example: LetsDoPython.py


Step 8: Write Your First Python Program

Type the following code:

Print(“Hello World”)


Step 9: Run the Program

To run the code:

  • Right-click → Run Code   OR
  • Press Ctrl + Alt + N

You’ll see the output:

Hello World



Now, you are entering in the world of programming your first program is run successfully.

Note: for safer side restart VS Code once after installing and configuring Python to avoid any setup issues.

Happy Coding!!!

Comments