Rates TodayNIFTY25,670-0.83%SENSEX83,630.7-0.83%Gold 24K ₹11,320.24/g down186.46Silver ₹134.77/g down2.72
InsightforGeeks
PythonPart of the Python learning hub

How to Install Python and Run Your First Program (Windows, macOS, Linux)

insightforgeeks-editorial
2 Dec 2026
3 min read
Share:

Python is free, and installing it takes a few minutes. This guide shows how to check whether you already have it, install it on Windows, macOS or Linux, and run your first program. At the end there is a list of the problems beginners hit most.

Step 1: check whether Python is already installed

Open a terminal (Command Prompt or PowerShell on Windows, Terminal on macOS and Linux) and type:

python3 --version

On Windows, use py --version or python --version instead. If you see something like Python 3.12.4, you are done with installation. Any Python 3 version is fine for learning. If you see an error, or a version that starts with 2, install a current Python 3 below.

Install on Windows

  1. Go to python.org/downloads and download the latest Python 3 installer.
  2. Run it. On the first screen, tick "Add python.exe to PATH" before you click Install. This is the step people miss, and it is the cause of the most common error later.
  3. When it finishes, open a new Command Prompt and run python --version.

Install on macOS

The simplest way is the installer from python.org/downloads. If you use Homebrew, run:

brew install python

Then check with python3 --version. If you type python3 on a Mac that has never had developer tools installed, macOS may offer to install the Command Line Tools first; accepting that also gives you a working Python 3.

Install on Linux

Most Linux systems already include Python 3. On Ubuntu or Debian, make sure the extra pieces you will need are present:

sudo apt update
sudo apt install python3 python3-pip python3-venv

On Fedora, use sudo dnf install python3.

Step 2: write and run your first program

Create a folder for your practice files, open it in any text editor (VS Code, Notepad++, even Notepad), and save a file called hello.py with this content:

name = input("What is your name? ")
print(f"Hello, {name}! Welcome to Python.")

In the terminal, go to that folder and run it:

python hello.py

On macOS and Linux, use python3 hello.py. Type your name and press Enter. The line starting with f" is an f-string: anything inside curly braces is replaced by the value of that variable.

The interactive shell

Typing just python (or python3) opens the interactive shell, where each line runs as soon as you press Enter. It is handy for trying small things:

>>> 2 + 3
5
>>> "py" * 3
'pypypy'
>>> exit()

Common problems

  • "python is not recognized" on Windows. Python was installed without "Add python.exe to PATH". Run the installer again, choose Modify, and tick the option, or use the py command instead.
  • The Microsoft Store opens when you type python. Windows has an alias that points to the Store. Install Python from python.org, then turn off the alias in Settings, Apps, Advanced app settings, App execution aliases.
  • "python: command not found" on macOS or Linux. Use python3. Many systems no longer provide a plain python command.
  • You see Python 2. Use python3 explicitly. Python 2 reached end of life in 2020 and should not be used.

What to do next

Before you install any libraries, learn to keep each project separate. Our guide to Python virtual environments, venv and pip shows how. After that, lists, tuples, dictionaries and sets are the next thing to learn, because most Python programs are built from them. You can also follow the full Python developer roadmap.

Tags:#python#install python#beginners#first program
Found this helpful? Share it with friends & colleagues
Share:
insightforgeeks-editorial Verified Editorial Staff

Covering financial markets, commodity rates, and practical technology insights for India. Researched and fact-checked in accordance with our Editorial Policy.

Published on 2 December 2026General Information · Disclaimer
More in Python