In the previous lesson you got to know Python "by reputation"; in this one you're going to install it on your computer and get everything ready to work. By the end you'll know how to install Python 3 on Windows, macOS or Linux, check that it works, use the interactive interpreter (REPL), run your first .py scripts and work with a professional editor: Visual Studio Code. A well-configured environment from the start will save you hours of frustration; it's worth doing calmly.

Contents

  1. What exactly do you need?
  2. Installing Python 3 on Windows
  3. Installing Python 3 on macOS
  4. Installing Python 3 on Linux
  5. Verifying the installation
  6. The interactive interpreter (REPL)
  7. Writing and running your first .py script
  8. Installing and configuring Visual Studio Code

What exactly do you need?

To program in Python you only need two pieces:

Piece What it is Example
The Python interpreter The program that understands and executes Python code. Python 3.12 (or later)
A code editor Where you write your programs. A specialized editor colors the code, warns about errors and autocompletes. Visual Studio Code

In theory you could write Python in Notepad, but a good editor makes all the difference. In this course we'll use Visual Studio Code (VS Code): free, cross-platform and the most widely used in the community.

A note on versions: always install a recent version of Python 3 (3.10 or later). The course examples work on any modern Python 3.

Installing Python 3 on Windows

  1. Open your browser and go to the official website: https://www.python.org/downloads/.
  2. Click the yellow Download Python 3.x.x button (it will offer you the latest stable version).
  3. Run the downloaded installer. On the first screen, before clicking "Install Now", tick these two boxes:
    • "Add python.exe to PATH" — essential. It lets you run python from any terminal. Forgetting this box is the number one cause of problems on Windows.
    • "Use admin privileges when installing py.exe" (if shown).
  4. Click Install Now and wait for it to finish.
  5. Close the installer.

Forgot to tick "Add to PATH"? No need to blindly reinstall: run the installer again, choose Modify, and in the advanced options enable "Add Python to environment variables". Or simply uninstall and install again with the box ticked.

On Windows there's also the option of installing Python from the Microsoft Store; it works, but the python.org installer is the more standard route and the one we'll use as our reference.

Installing Python 3 on macOS

macOS sometimes includes an old version of Python, but you shouldn't rely on it. You have two options:

Option A — Official installer (recommended to start with):

  1. Go to https://www.python.org/downloads/ and download the installer for macOS.
  2. Open the downloaded .pkg file and follow the wizard (Continue → Agree → Install).
  3. When it finishes, you'll have Python 3 available as python3 in the terminal.

Option B — Homebrew (if you already use this package manager):

brew install python

On macOS and Linux the command is usually called python3 (with the 3), not python. Keep that in mind when following the examples.

Installing Python 3 on Linux

Most modern distributions already include Python 3. Check first (next section); if it's not there or you want to make sure you have the complete tooling:

Debian / Ubuntu / Linux Mint:

sudo apt update
sudo apt install python3

Fedora:

sudo dnf install python3

Arch Linux:

sudo pacman -S python

Verifying the installation

Open a terminal:

  • Windows: search for "PowerShell" or "Command Prompt" in the Start menu.
  • macOS: the Terminal application (in Applications → Utilities).
  • Linux: your usual terminal emulator.

And type:

python --version

If it doesn't respond (common on macOS/Linux), try:

python3 --version

You should see something like:

Python 3.12.4

If a version number starting with 3 appears, everything is in order. For the rest of the course we'll write python in the examples; if on your system the command is python3, use it interchangeably.

System Usual command
Windows python (or py)
macOS python3
Linux python3

The interactive interpreter (REPL)

Python ships with a fantastic tool for learning: the REPL (Read-Eval-Print Loop). It's a conversation with Python: you type an instruction, it executes it and shows you the result immediately.

To enter it, simply type in the terminal:

python

You'll see something like this:

Python 3.12.4 (main, Jun  8 2026, 12:00:00)
Type "help", "copyright", "credits" or "license" for more information.
>>>

That >>> is the prompt: Python awaits your commands. Try a few:

>>> print("Welcome to Papyrus")
Welcome to Papyrus
>>> 15.90 + 12.50
28.4
>>> "Papyrus " * 3
'Papyrus Papyrus Papyrus'

Notice three details:

  • The first instruction uses print() to display a greeting, as in the previous lesson.
  • The second shows that the REPL works as a calculator: we've added the prices of two of the shop's books and Python responds with the result without needing print().
  • The third reveals something curious: multiplying a text by 3 repeats it three times. The REPL is perfect for making this kind of experiment without fear.

To exit the REPL, type exit() and press Enter (or press Ctrl+Z followed by Enter on Windows, Ctrl+D on macOS/Linux).

flowchart LR
    A["You type an instruction\n(Read)"] --> B["Python executes it\n(Eval)"]
    B --> C["It shows the result\n(Print)"]
    C --> A

The REPL is ideal for trying small things, but what you type in it is lost when you close it. To keep programs we need files.

Writing and running your first .py script

A script is a text file with the .py extension that contains Python code. Let's create the first one for the Papyrus project:

  1. Create a folder for the course, for example papyrus (in your documents folder or wherever you prefer).
  2. Inside it, create a text file called welcome.py with this content:
# welcome.py - First script of the Papyrus project
print("=================================")
print("  PAPYRUS - Neighbourhood bookshop")
print("=================================")
print("Management system under construction...")
  1. Open a terminal, move into the folder with cd and run it:
cd papyrus
python welcome.py

The result:

=================================
  PAPYRUS - Neighbourhood bookshop
=================================
Management system under construction...

Key points:

  • The line starting with # is a comment: Python ignores it. (We'll look at them in detail in the next lesson.)
  • python welcome.py tells the interpreter: "run this file from top to bottom".
  • Unlike the REPL, the script is saved and you can run it as many times as you like.
REPL .py script
Interactive, immediate result Runs from start to finish
Ideal for experimenting and trying ideas Ideal for programs you want to keep
Lost when the session closes Saved on disk
Shows results automatically Only shows what you pass to print()

Installing and configuring Visual Studio Code

Writing scripts with Notepad is possible, but uncomfortable. Let's install a real editor:

Installation

  1. Go to https://code.visualstudio.com/ and download the version for your operating system.
  2. Install it with the default options (on Windows, it's useful to tick "Add to PATH" and the "Open with Code" context-menu options).

The Python extension

VS Code is a generic editor; for it to fully understand Python you need to add the official extension:

  1. Open VS Code.
  2. Click the Extensions icon in the left sidebar (or Ctrl+Shift+X / Cmd+Shift+X).
  3. Search for "Python" and install the extension published by Microsoft (it's usually the first one, with millions of downloads). Pylance, its autocompletion companion, will be installed too.

With the extension active you get:

  • Syntax highlighting: keywords, texts and numbers in different colors.
  • Autocompletion: VS Code suggests names as you type.
  • Error detection: it underlines obvious mistakes in red before you run.
  • Run button: a triangle ▷ at the top right runs the current file without leaving the editor.

Recommended workflow

  1. In VS Code: File → Open Folder... and select your papyrus folder. Working "by folders" (not file by file) is the professional habit.
  2. Create or open welcome.py.
  3. Run it with the ▷ button or open the integrated terminal (Terminal → New Terminal, or Ctrl+`) and type python welcome.py.

VS Code's integrated terminal is a normal terminal embedded in the editor: everything you've learned in this lesson works the same inside it.

Common Mistakes and Tips

  • python is not recognized as a command (Windows): almost always the "Add python.exe to PATH" box wasn't ticked. Reinstall or modify the installation as explained above, and open a new terminal afterwards (already-open ones don't pick up the change).
  • On macOS/Linux, python opens Python 2 or doesn't exist: use python3. That's the standard name on those systems.
  • Saving the script as welcome.py.txt: Windows Notepad sneakily appends .txt. Use VS Code to create your files and you'll avoid the problem.
  • Running python welcome.py from the wrong folder: the terminal must be in the folder where the file lives (use cd to move around, and dir on Windows or ls on macOS/Linux to list the contents and check the file is there).
  • Writing code in the REPL expecting it to be saved: the REPL is ephemeral. Anything you want to keep goes in a .py file.
  • Tip: spend five minutes exploring the REPL as a calculator. Losing the fear of "trying things out" is one of a programmer's most valuable skills.

Exercises

Exercise 1

Install Python on your system and verify the installation. Note down: (a) the command you used to verify it and (b) the exact version you have installed.

Exercise 2

Open the REPL and, without leaving it:

  1. Display the text Papyrus opens its doors using print().
  2. Calculate how much three of the shop's books costing 12.50, 18.90 and 9.95 would cost together.
  3. Exit the REPL properly.

Exercise 3

In your papyrus folder, create a script called initial_catalog.py that displays the shop's name and three titles from its catalog (for example The Odyssey, Don Quixote and Hamlet), one per line, and run it from the terminal (or from VS Code).

Solutions

Solution 1

python --version

(or python3 --version on macOS/Linux). The output should be something like Python 3.12.4. Any version 3.10 or later is suitable for the course.

Solution 2

>>> print("Papyrus opens its doors")
Papyrus opens its doors
>>> 12.50 + 18.90 + 9.95
41.35
>>> exit()

In step 2 you don't need print(): the REPL automatically shows the result of each expression. To exit, Ctrl+Z + Enter (Windows) or Ctrl+D (macOS/Linux) also work.

Solution 3

Content of initial_catalog.py:

# initial_catalog.py - First books in the Papyrus catalog
print("Papyrus catalog")
print("The Odyssey")
print("Don Quixote")
print("Hamlet")

Running it:

cd papyrus
python initial_catalog.py
Papyrus catalog
The Odyssey
Don Quixote
Hamlet

Conclusion

You now have a complete development environment: Python 3 installed and verified, basic fluency with the REPL for experimenting, the ability to run .py scripts from the terminal and VS Code configured with the Python extension for comfortable work. On top of that, Papyrus already has its first welcome script and an initial catalog on screen.

From now on you'll run all the course code yourself. In the next lesson, Python Syntax and Basic Data Types, we'll start programming for real: indentation, comments, numbers, texts, booleans and the operators to combine them.

Python Programming Course

Module 1: Introduction to Python

Module 2: Control Structures

Module 3: Functions and Modules

Module 4: Data Structures

Module 5: Object-Oriented Programming

Module 6: File Handling

Module 7: Error and Exception Handling

Module 8: Advanced Topics

Module 9: Testing and Debugging

Module 10: Web Development with Python

Module 11: Data Science with Python

Module 12: Final Project

© Copyright 2026. All rights reserved