🐍 Python Course · Stage 0 · Lesson 2 of 89 · Setting Up Python
Course Overview →

🟩 Start with the Beginner tab. Read it fully before moving on.

← What is Python? Variables & Types →
thecodex.expert · The Codex Family of Knowledge
Python

Setting Up Python

Install Python, pick an editor, and write your first program. From zero to running code in under 10 minutes.

Python 3.13 docs.python.org Last verified:
Don't want to install anything yet?

Use the Python Playground — it runs Python directly in your browser with no setup needed. Come back here when you're ready to write Python on your own computer.

Windows users: don't miss the checkbox. During installation, there is a checkbox that says "Add Python to PATH". Tick it before clicking Install. If you miss it, Python will install but won't be found when you type python in the terminal — you'll need to reinstall.

Step 1 — Install Python

Python does not come pre-installed on Windows. On macOS and Linux it may be present, but often an older version. Always install the latest Python 3 from the official source.

Operating SystemHow to install
WindowsGo to python.org/downloads → click "Download Python 3.x.x" → run the installer. Tick "Add Python to PATH" before clicking Install — this is the most common mistake people miss.
macOSGo to python.org/downloads → download the macOS installer → run it. Alternatively, if you have Homebrew: brew install python
Linux (Ubuntu/Debian)Python 3 is usually pre-installed. Check: python3 --version. To install: sudo apt install python3
Python 3 only — never Python 2

Python 2 reached end-of-life in 2020 and is no longer maintained. Always install Python 3. If you see tutorials using print "hello" (no parentheses), they are Python 2 — ignore them.

Verify the installation by opening your terminal (Command Prompt on Windows, Terminal on macOS/Linux) and typing:

Shellterminal
python --version
# or on macOS/Linux:
python3 --version

You should see something like Python 3.13.0. If you do, Python is installed and ready.

💡

VS Code is the recommendation. Install it, then install the Python extension by Microsoft from the Extensions panel (Ctrl+Shift+X or Cmd+Shift+X). This single extension gives you syntax highlighting, autocomplete, linting, and the ability to run Python files directly from the editor.

Step 2 — Choose a Code Editor

A code editor is where you write your Python files. You could use Notepad, but a proper editor helps you enormously — it highlights your code in colour, shows errors before you run, and handles indentation (which Python cares about deeply).

EditorBest forCost
VS CodeEveryone — the most popular choice by far. Lightweight, fast, excellent Python support via the Python extension.Free
PyCharm CommunityPython-specific. More powerful out of the box for Python, slightly heavier.Free
ThonnyAbsolute beginners. Simpler interface, built-in Python, great for learning.Free
Jupyter NotebookData science, experimentation. Mix code and text in "cells".Free

Recommendation if you're just starting: Install VS Code (code.visualstudio.com), then install the Python extension by Microsoft from the Extensions panel (Ctrl+Shift+X). This gives you everything you need.

Actually do this step. Create the file. Type the code. Run it. Seeing your own code produce output is the moment learning starts. "Hello, world!" is a rite of passage that every professional programmer has done.

Step 3 — Write and Run Your First Program

Create a new file called hello.py. Type this exactly:

Pythonhello.py
print("Hello, world!")
print("My name is Priya")
print("I am learning Python")

Now run it. Open your terminal, navigate to the folder where you saved the file, and type:

Shellterminal
python hello.py
# or on macOS/Linux:
python3 hello.py

You should see:

Outputresult
Hello, world!
My name is Priya
I am learning Python
You just ran your first Python program

print() is Python's way of displaying output. Whatever you put inside the parentheses — in quotes — appears on the screen. That's genuinely all there is to it.

💡

What is the REPL? REPL stands for Read-Eval-Print Loop. You type one line, Python reads it, evaluates it, prints the result, and waits. Use it for quick experiments — testing what a function does, checking what type something is, or trying an expression. It's the fastest feedback loop you have.

The Interactive Shell (REPL)

Python has an interactive mode where you type one line and immediately see the result. Just type python (or python3) in your terminal with no filename:

ShellPython interactive shell
$ python3
Python 3.13.0 (...)
>>> print("hello")
hello
>>> 2 + 2
4
>>> name = "Priya"
>>> print("Hello", name)
Hello Priya
>>> exit()    # to quit

The >>> prompt means Python is waiting for your input. This is called the REPL (Read–Eval–Print Loop). It's perfect for quick experiments — try a line of code, see what happens immediately. No file needed.

Common setup mistakes
"Python is not recognized as a command." On Windows, this means Python wasn't added to PATH during installation. Reinstall Python and tick the "Add Python to PATH" checkbox, or search "Edit environment variables" in Windows and add the Python folder manually.
Using python vs python3. On macOS and Linux, python may refer to the old Python 2. Use python3 and pip3 to be safe. On Windows, python usually refers to Python 3 after a fresh install.
Indentation errors on your first file. Python uses indentation (spaces/tabs at the start of lines) to structure code. If you get an IndentationError, check that you're not accidentally mixing spaces and tabs. VS Code handles this automatically — another reason to use a proper editor.

What's next

You have Python installed, an editor ready, and you've run your first program. Now the actual learning begins. Follow the course in order — every concept builds on the previous one.

Source confidence: High Last verified: Primary source: Python Docs · docs.python.org/3/using/