Every coding journey begins with a single step: setting up your environment. Whether you are diving into data science, building web applications, or just automating daily tasks, you need to know how to install Python correctly to avoid headaches down the road.
In this guide, we will walk through exactly how to install Python across the most popular operating systems—Windows, macOS, and Ubuntu (Linux). We’ll cover the best installation methods, how to verify your version, and finally, how to write your very first line of Python code today. Let’s get started. (Check for Windows, MacOS and Ubuntu)
How to check current Python version (if installed)
Before we start installing Python, we first need to check if Python is already installed in the system. To verify this, open a command line interface of your choice and execute python --version or python3 --version.
If Python is already installed, you should see something like “Python 3.X.Y” on your terminal where Python 3 is the major version we are going to learn (not Python 2) and “X” and “Y” are the minor and patch version numbers respectively.
If you see something like “'python' is not recognized as an internal or external command, operable program or batch file” or something that reads “Python was not found; run without arguments to install from the Microsoft Store, or disable this shortcut from Settings > Manage App Execution Aliases” you need not to worry. This simply means, Python has not been installed yet and we need to do it now. Let’s learn how.
How to Install Python on Windows
Windows is one of the most popular operating system across the globe. So, if you are a windows user, this is the place where you should keep your focus on.
Method 1: The Official Python Installer (Recommended)
The most common way to install Python in your computer is via the Python official website: https://www.python.org/downloads/windows/. So, once you click on the link and reach the webpage, follow the below instructions.
Step 1: Download the Latest Python Release. On the webpage, look for the section that says Stable Releases and click on the Download Windows installer (64-bit) link for the latest Python 3 version. This will download a .exe file directly to your system.
Step 2: Run the Installer (Don't miss this crucial step!). Double-click the downloaded .exe file to launch the Python setup wizard. Before you click anything else, look at the very bottom of the installation window and check the box that says Add Python.exe to PATH. This is the most important step in the entire Python installation process, as it allows you to run Python commands from any command prompt window. Once checked, click Install Now.Don't forget to tick this checkbox
Step 3: Verify the Python Installation. To confirm your Python development environment is set up correctly, open your Command Prompt (search for cmd in your Windows search bar). Type python --version and hit Enter. If you see the Python version number pop up, congratulations! You have successfully installed the Python programming language on Windows.
Method 2: Install Python from Microsoft Store
If this seems a little intimidating to start with, I have one more option for you. Directly downloading Python from Microsoft Store. In this way, you need not to manually take care of the PATH variable. The installation is smooth and as easy as downloading an app from your mobile’s app store.
Step 1: Open the Microsoft Store app on your PC.
Step 2: Search for "Python" and select the latest version (e.g., Python 3.12 or 3.13 as of 2026).
Step 3: Click Get or Install.
Step 4: Once finished, open your terminal and type python --version to verify. If you see something like “Python 3.X.Y”, congratulations! You have finally installed Python and now you are ready to go.---
How to Install Python on MacOS
macOS used to come with Python 2 pre-installed, but Apple has since removed it. You'll need to install Python 3 yourself. If you write python3 in the terminal of your machine, you will see macOS will not immediately run Python. Instead, it prompts you to install the Xcode Command Line Tools. Once you install the tools, you will see an older version of Python3 has been downloaded. But as of this tutorial, we will be using Python 3.14, so we will have to setup Python manually. There are 2 popular ways for this –
Method 1: Homebrew (The Developer's Choice)
If you are developing on a Mac, you should be using Homebrew—a phenomenal package manager for macOS.
Step 1: First check if you have homebrew installed by running brew --version. If you see some kind of error message, you will have to manually download homebrew. For this, open your terminal and execute the command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
markdown
This will setup homebrew in the system
Step 2: Install Python by running:
brew install python@3.14 Step 3: Check if Python is installed by running
python3 --version
markdown
Method 2: The Official Installer
If you prefer not to use the terminal for installation, you can use the standard macOS package.
Visit python.org/downloads and download the macOS installer.
Open the downloaded .pkg file and follow the standard installation wizard.
Once installed, navigate to your Applications folder, open the Python 3.x folder, and double-click the Install Certificates.command file. (This fixes common SSL errors when Python tries to download resources from the web).---
How to Install Python on Ubuntu (Linux)
Linux and Python are best friends. Most Ubuntu distributions come with Python pre-installed, but you often need to install updates or developer tools.
Method 1: APT Package Manager (The Standard Way)
The safest way to install Python on Ubuntu is through the default package repositories.
Step 1: Firstly, we have to open the terminal and update the package list:
sudo apt update Step 2: Then we will install Python3 and its package manager pip by running the command: sudo apt install python3, python3-pip, python3-venv
Step 3: Finally, we will verify the installed version:
python3 --version
markdown
Method 2: The Deadsnakes PPA (For newer or specific versions)
If the default Ubuntu repositories don't have the newest version of Python you need, use the trusted Deadsnakes PPA.
Step 1: Firstly, add the repository to your stream:
sudo add-apt-repository ppa:deadsnakes/ppa Step 2: Then update the package list: sudo apt update
Step 3: Finally, you can install the specific Python version that you need:
sudo apt install python3.14 python3.14-venv
markdown
Step 4: Once installation is complete you can verify by running:
python3.14 --version Your First Code: The “Hello World” in Python
You have Python installed. Now, it’s time for the magic. Let's write your first Python program to prove everything is working perfectly.
Step 1: Open the Interactive Shell
Open your terminal (or Command Prompt) and type python or python3, then press Enter. You should see a welcome message and a prompt that looks like >>>. This is Python’s interactive mode (also known as the REPL).
Step 2: Write Your Code
Type the following exact command next to the >>> prompt and press Enter:
print(“Hello World!”) Step 3: See the Result
Python will instantly respond by printing: “Hello, World!” Congratulations! You just asked Python to display a sentence, and it executed your command perfectly.
You now have a fully functioning Python environment and your first successful program with you. But this is just the beginning.---
What's next?
- Hit a roadblock? Let's fix your PATH: If you tried to run the code above on a PC and your Command Prompt spat out an ugly "'python' is not recognized as an internal or external command" error, don't panic! This is the most common beginner hiccup, and it just means your OS doesn't know where Python lives yet. If you are on a PC, head over to my dedicated troubleshooting guide to fix the Windows PATH environment variable and TARGETDIR installer errors so you can run Python from any folder. Alternatively, if you are working on an Apple silicon Mac or Ubuntu machine and your terminal throws a zsh: command not found: python or bash error, you likely need to configure your shell profile. You can resolve this instantly with my guide to fixing macOS and Linux Python PATH errors.
- Start your coding journey: If your "Hello World" printed perfectly, you are ready for the real deal. You won't be writing code in the terminal forever! We will set up a proper code editor and start building real projects from day one. Did you run into any other weird errors during installation? Feel free to send us an email at samraat@papiable.com, and I'll help you troubleshoot!
Thanks for reading! I publish deep-dives on Python basics and internals every week. For more tutorials on CPython mechanics, you can read my full archive at Papiable.com or follow me here.

