Skip to content

Installing Python and VS Code

5 min read

In this lesson you'll install Python and a code editor on your computer, and check that both work. Your own Python lets programs save files and keep running after you close the tab, and from Module 8 on you'll need it. It takes about twenty minutes, most of it waiting for downloads.

What you're installing

You need two things.

The first is Python itself: the that runs your code. The Python on this page is the same language, packed to run inside a browser. Press Run to ask it which version it is.

import sys
print("Python", sys.version_info.major, sys.version_info.minor)

In the editor, press Escape then Tab to move on.

That means Python 3.14, the newest version. The first line borrows a built-in toolbox called sys that knows about the Python running your code; you'll learn import later. On your computer, anything from 3.12 up works for this course.

The second is a . We'll use VS Code: it's free, runs on Windows, macOS, and Linux, and has an official Python extension from Microsoft.

The downloads are large, so use Wi-Fi if you can. Python is about 50 MB on Windows and 80 MB on a Mac; VS Code is about 230 MB.

Opening a terminal

You'll type a few commands into the . If you've never used one, that's normal. Typing a command there is safe: the commands in this lesson only install and check things.

Press the Windows key, type PowerShell, and press Enter. The line where you type starts with the folder you're in, then >:

Terminal
PS C:\Users\Hana>

That line is called the prompt. It's the terminal waiting for you. Type a command after it and press Enter.

Installing Python

Pick your system. The steps are different on each one.

Windows installs Python through the Python install manager, a small app from python.org that installs and updates Python for you. It needs Windows 10 or later.

  1. Get the install manager

    Open the Microsoft Store, search for Python Install Manager, and install it. If you can't use the Store, go to python.org/downloads and click Download Python install manager, then open the downloaded file. Both are the same app.

  2. Open a new terminal

    Open PowerShell as above. Always open a new terminal after installing something; windows that were already open don't see new programs.

  3. Run the configuration checker

    Type this and press Enter. It checks your settings and asks a few questions; type y and press Enter to accept each one. If it offers to install the latest Python, say yes to that too.

    py install --configure
  4. Check it

    Ask Python for its version. The first time, it may download Python before answering, which takes a minute.

    python --version

    Then list the Pythons the install manager has set up:

    py list

Older videos and tutorials show a different installer with an "Add Python to PATH" box to tick. That installer is being retired; the steps above are the current way.

If it worked, you'll see one line with a version number, for example:

Output
Python 3.14.7

Your number may differ; 3.12 or higher is what matters.

Quick check

You typed python --version on a Mac and got command not found: python. What should you try?

Commands and code are different things

python --version is a command for the terminal, not Python code. The terminal and Python are two different places. Here's what Python does with that same text in quotes:

What will this print?

Decide before you look. Guessing wrong is how this sticks.

print("python --version")

Python prints

python --version

Inside quotes, it's only text, so print shows it as it is. Python doesn't run terminal commands; only the terminal does.

You'll see what happens without the quotes, and how to tell which place you're in, in lesson 0.4.

Setting up VS Code

  1. Install VS Code

    Download it from code.visualstudio.com and install it with the default choices.

  2. Add the Python extension

    Open VS Code, click the Extensions icon on the left (or press Ctrl + Shift + X, Cmd + Shift + X on a Mac), search for Python, and install the one published by Microsoft.

  3. Open a folder for your code

    Make a folder called python-course anywhere you like. In VS Code, choose File, then Open Folder, and pick it. Every file you make in this course can live there.

  4. Choose your Python

    Press Ctrl + Shift + P (Cmd + Shift + P on a Mac), type Python: Select Interpreter, and pick the newest Python in the list. This tells VS Code which Python runs your files.

Exercise

Check your setup

Write a program that prints three lines, one for each thing you installed, exactly like this. Run it here first. Then save it as setup_check.py in your python-course folder; you'll run that file from the terminal in lesson 0.4.

Output
Python is installed.
VS Code is installed.
The Python extension is installed.

Your code

# Print one line for each thing you installed

In the editor, press Escape then Tab to move on.

Show a solution

This is one way to solve it, not the only one. If yours prints the same thing, it works.

print("Python is installed.")
print("VS Code is installed.")
print("The Python extension is installed.")

Key takeaways

  • On Windows, install Python with the Python install manager and run py install --configure; on macOS, use the installer from python.org; most Linux systems already have it.
  • Check it in the terminal: python --version on Windows, python3 --version on macOS and Linux.
  • If Windows can't find python, open a new terminal, try py, then check the app execution aliases.
  • Terminal commands and Python code are different things.
  • VS Code with Microsoft's Python extension is your editor for this course.