LearnContact
Lesson 320 min read

Installation & Setup

Install Python on your computer, verify it works, and set up a beginner-friendly editor so you can start writing and running real Python programs.

Introduction

Before you can write a single line of Python, you need Python itself installed on your computer. Unlike languages that run in a browser, Python code needs an interpreter installed locally to read and execute it.

This lesson walks through downloading and installing Python on Windows, macOS, and Linux, confirming the install worked, and picking an editor so you are fully ready to write real code.

What You Will Learn
  • How to download Python from the official source.
  • How to install Python on Windows, macOS, and Linux.
  • How to verify your installation from a terminal.
  • What the Python REPL is and how to use it.
  • How to choose an editor and run a .py file.

Downloading Python

The official source for Python is python.org. Visiting the Downloads page automatically detects your operating system and offers the latest stable release, which is the version recommended for almost everyone starting out.

Always download Python from python.org (or your operating system's trusted package manager) rather than an unofficial source, to avoid modified or unsafe installers.

python.org

The official, safe source for downloading Python for every major operating system.

Latest Stable Release

Always prefer the newest stable Python 3.x version unless a project requires otherwise.

Cross-Platform Installers

Separate installers are provided for Windows, macOS, and various Linux distributions.

Installing on Windows

On Windows, download the installer .exe from python.org and run it. The single most important step is on the very first installer screen: make sure the checkbox labeled "Add python.exe to PATH" (or "Add Python to PATH") is checked before clicking Install Now.

Adding Python to PATH lets you type python from any folder in the terminal (Command Prompt or PowerShell) without typing the full install location. Skipping this checkbox is the most common reason beginners get a "python is not recognized" error afterward.

Do Not Skip This
  • On the first installer screen, check "Add Python to PATH."
  • If you forget, you can re-run the installer and choose "Modify" to fix it.
  • Without this, python.exe will not be recognized in the terminal.

Installing on macOS

On macOS, download the .pkg installer from python.org and run it like any other Mac application installer, following the on-screen steps. macOS ships with its own older system Python used internally by the operating system, so the python.org installer keeps your version separate and up to date.

After installing, macOS users typically run the command python3 rather than python, since the name python may be reserved by the system's built-in version.

Installing on Linux

Most Linux distributions already include Python 3 pre-installed. You can check your version and, if needed, install or update Python using your distribution's package manager.

Common Linux install commands
# Debian/Ubuntu
sudo apt update
sudo apt install python3

# Fedora
sudo dnf install python3

As on macOS, Linux users typically use the command python3 to run the correct version.

Verifying Your Installation

Once installed, open a terminal (Command Prompt, PowerShell, or Terminal app) and check the installed version to confirm everything worked.

Verifying Python
python --version
# or, on macOS/Linux
python3 --version
Output
Python 3.12.4

If you see a version number like this, Python is installed correctly. If instead you see an error like "command not found" or "not recognized," Python is either not installed or not added to PATH.

What Is the REPL?

Typing python (or python3) alone with no filename opens the interactive interpreter, often called the REPL — short for Read, Evaluate, Print, Loop. It reads one line of code you type, evaluates it immediately, prints the result, and loops back for your next line.

The REPL is identified by the >>> prompt and is extremely useful for quickly testing small pieces of code without creating a file.

Read

The REPL reads the line of Python code you type.

Evaluate

It immediately runs that code.

Print

It shows you the result, if there is one.

Loop

It waits for your next line of code.

Example: Using the REPL

Open a terminal, type python (or python3), press Enter, and you will see the >>> prompt. Try typing a simple expression.

Inside the REPL
>>> 2 + 2
4
>>> print("Hello from the REPL")
Hello from the REPL
>>> exit()

Typing exit() (or pressing Ctrl+Z then Enter on Windows, or Ctrl+D on macOS/Linux) leaves the REPL and returns you to your normal terminal.

Choosing an Editor

The REPL is great for quick tests, but real programs are written and saved in .py files using a code editor. Beginners have several good, free options.

VS Code

A free, extremely popular editor. Install the official "Python" extension for syntax highlighting, error checking, and one-click running.

IDLE

A simple editor that installs automatically alongside Python itself — good for very first steps with zero extra setup.

PyCharm

A full-featured, Python-specific IDE with powerful tools, popular for larger projects.

For this course, VS Code with the Python extension is the recommended setup — it is free, widely used in the industry, and works well for beginners and professionals alike.

Running a .py File

Once you save code in a file ending in .py, you run it from a terminal by typing python (or python3) followed by the filename, from the same folder the file is saved in.

Running a script
python hello.py
# or, on macOS/Linux
python3 hello.py

Example: Running a Script

Create a file named hello.py containing a single line, save it, then run it from the terminal in that folder.

hello.py
print("Setup complete!")
Terminal
python hello.py
Output
Setup complete!

Common Mistakes

Avoid These Mistakes
  • Forgetting to check "Add Python to PATH" during Windows installation.
  • Running python when python3 is required (common on macOS/Linux), or vice versa.
  • Trying to run a .py file from the wrong folder in the terminal.
  • Downloading Python from an untrusted, non-official website.

Best Practices

  • Always install Python from the official python.org site.
  • Verify your installation immediately with --version before moving on.
  • Pick one editor (VS Code is recommended) and get comfortable with it.
  • Keep your project files organized in a dedicated folder.

Frequently Asked Questions

Do I need python or python3 on the command line?

On Windows, python usually works after installation. On macOS and Linux, python3 is the safer command since python may not be linked to Python 3.

What if "python is not recognized" appears on Windows?

This usually means Python was not added to PATH during installation. Re-run the installer, choose Modify, and ensure "Add Python to PATH" is checked.

Is IDLE good enough to learn Python?

Yes, IDLE is a perfectly fine starting point since it installs automatically with Python, though most learners eventually move to VS Code or PyCharm for a better experience.

Do I need to pay for an editor?

No. VS Code, IDLE, and the Community edition of PyCharm are all completely free.

Can I have multiple Python versions installed?

Yes, multiple versions can coexist, though beginners should focus on having one recent Python 3.x version working reliably first.

Key Takeaways

  • Download Python only from the official python.org website.
  • On Windows, always check "Add Python to PATH" during installation.
  • Verify installation with python --version or python3 --version.
  • The REPL (>>>) lets you run Python code interactively, line by line.
  • VS Code with the Python extension is a great, free editor for this course.

Summary

With Python installed and verified, and an editor ready to go, you now have everything you need to start writing real Python programs. The REPL is useful for quick experiments, while .py files and an editor are how you will build actual programs.

In this lesson, you installed Python, verified it works, explored the REPL, and learned how to run a .py file from the terminal. Next, you will write and run your very first complete Python program.

Lesson 3 Completed
  • You have Python installed and verified on your computer.
  • You know what the REPL is and how to use it.
  • You have chosen an editor to write code in.
  • You are ready to write your first real Python program.
Next Lesson →

Your First Python Program