Setting Up Python 3 in Visual Studio Code (Mac/Windows)

Farhaan Nazirkhan
3 min readMar 30, 2023

--

Here’s how to set up Python 3 in VS Code:

Prerequisites:

Visual Studio Code is already installed on your system.

Step 1:

Install Python 3: If Python 3 isn’t already installed on your computer, you may download it from the official Python website and install it.

Windows Users: Please ensure that we have selected the checkbox with the label “Add Python 3.7 to PATH” while doing the installation of the software.

Installing Python 3 (Windows)
Installing Python 3 (Mac)

Step 2:

Install the Python extension for VS Code: Open VS Code and go to the Extensions tab on the left-hand side. Search for “Python” in the extensions marketplace and install the official Python extension from Microsoft.

Python Extension

Step 3:

Install the Code Runner extension for VS Code: Open VS Code and go to the Extensions tab on the left-hand side. Search for “Code Runner” in the extensions marketplace and install the official Code Runner extension from Jun Han.

Code Runner Extension

Step 4:

Create a new Python file: Click on the Explorer tab on the left-hand side of VS Code and click on open folder, and then create a new folder for your Python project. Right-click on the folder and select “New File”. Name the file with a .py extension (e.g. “Hello_World.py”).

Creating a new folder
Creating a New File

Step 5:

Write some Python code: Start writing your Python code in the new file. VS Code will automatically detect that it’s a Python file and provide syntax highlighting and other features.

Writing Code

Step 6:

Run your Python code: Press F5 to run your Python code in VS Code’s built-in debugger. Alternatively, you can click on the small play icon located at the upper right of the code editor.

Executed Code

Thank you so much for taking the time to read my article. Do not forget to follow me so that you do not miss out any future articles.

--

--

Farhaan Nazirkhan

A proactive Software Engineering student with a passion for computer programming and Information Technology.