How to Install Python on Windows, macOS, and Linux
Installing Python is one of the first steps in learning the language. This guide shows you how to install Python 3 on Windows, macOS, and Linux, how to check whether it is already installed, and how to verify that it works correctly.
The goal is simple: get one working Python 3 installation that you can run from the command line without confusion.
Quick check
Run these commands after installation to check whether Python is installed and which command name your system uses:
python --version
python3 --version
If one of these shows a Python 3 version number, Python is installed.
What this page helps you do
- Install Python on Windows, macOS, or Linux
- Check whether Python is already installed
- Verify the installation from the command line
- Understand whether to use
pythonorpython3 - Avoid common setup mistakes
Before you install Python
A few important things to know first:
- You only need one working Python 3 installation to start learning.
- Many systems already include some version of Python.
- The main goal is to make sure Python 3 is installed and easy to run.
- It is normal if your computer uses
python3instead ofpython.
If you are a beginner, install Python 3 and ignore Python 2. Python 2 is outdated and should not be used for new code.
How to check if Python is already installed
Before downloading anything, check whether Python is already available.
- On Windows, open Command Prompt or PowerShell
- On macOS or Linux, open Terminal
Then run:
python --version
If that does not work, try:
python3 --version
What the result means
- If you see something like
Python 3.12.3, Python is installed. - If you get a message such as
command not foundor'python' is not recognized, Python is not available through that command. - If
pythonfails butpython3works, that is normal on many systems.
Install Python on Windows
To install Python on Windows:
- Go to the official Python website:
https://www.python.org/ - Download the latest Python 3 installer for Windows.
- Run the installer.
- Turn on the checkbox that says "Add Python to PATH"
- Click Install Now
- Wait for the installation to finish
- Open a new Command Prompt window
- Run:
python --version
Important Windows tip
The Add Python to PATH checkbox matters. If you skip it, Python may install correctly but the python command may not work in Command Prompt.
If installation worked
You should see a version number, for example:
Python 3.12.3
Install Python on macOS
Many macOS systems already have python3 available, so check first:
python3 --version
If that does not work:
- Go to the official Python website:
https://www.python.org/ - Download the latest Python 3 installer for macOS
- Open the installer package
- Follow the installation steps
- Open Terminal after installation
- Run:
python3 --version
On many macOS systems, you should use python3 instead of python.
Install Python on Linux
Many Linux distributions already include Python 3. Check first:
python3 --version
If Python 3 is not installed, use your package manager.
Ubuntu or Debian
sudo apt install python3
Fedora
sudo dnf install python3
Arch Linux
sudo pacman -S python
After installation, verify it:
python3 --version
On Linux, python3 is often the correct command for Python 3.
How to verify the installation
After installing Python, confirm that it actually runs.
First, check the version:
python --version
python3 --version
Then start the Python shell with whichever command works on your system:
python
or:
python3
You should see a prompt like >>>. Now type:
print("Hello, world!")
Expected output:
Hello, world!
If you see the output and no error appears, Python is working correctly.
How to exit the Python shell
- On all systems, you can type:
exit()
- On Windows, you can also press
Ctrl+Z, thenEnter - On macOS and Linux, you can also press
Ctrl+D
Understand python vs python3
This is one of the most common beginner questions.
Why there are two command names
Different operating systems use different command names:
- Some systems map
pythonto Python 3 - Some systems use
python3for Python 3 - Older systems may reserve
pythonfor Python 2
What you should do
- Try
python --version - If that does not work, try
python3 --version - Use the command that works on your system consistently
For example, if python3 works and python does not, run your programs like this:
python3 my_file.py
If you are not sure how to run a script after installation, see how to run Python code from the command line and IDEs.
What to do after installation
Once Python is installed, the next good steps are:
- Learn how to run a Python file
- Create your first Python program
- Choose a code editor or IDE
- Install packages with
piplater when needed - Ignore virtual environments for now unless a project specifically asks for one
Good next steps:
- Run Python code from the command line and IDEs
- Write your first Python program
- Install a Python package with pip
Troubleshooting common install problems
If Python still does not work after installation, these are the most common reasons.
Python installed but command not found
This usually means Python was installed, but the command is not available in your terminal.
Common causes:
- Python was installed but not added to PATH
- The terminal was not reopened after installation
- You are using
pythonwhen your system expectspython3
On Windows, try closing and reopening Command Prompt or PowerShell.
On macOS and Linux, try python3 if python fails.
Multiple Python versions are causing confusion
Some computers already have another Python version installed. That can make it unclear which one is running.
Use these commands to check:
python --version
python3 --version
where python
where python3
which python
which python3
How to use these commands
- On Windows,
whereshows the path to the executable - On macOS and Linux,
whichshows the path
If the path points to an unexpected location, you may be using a different Python installation than you thought.
Common setup mistakes
- Installing Python but forgetting to add it to PATH
- Using
pythonwhen onlypython3works - Not reopening the terminal after installation
- Assuming the newest installed version is the one being used
- Using a store or package source that behaves differently from the official installer
- Checking the wrong command when Python is already installed
FAQ
Should I install Python 2 or Python 3?
Install Python 3. Python 2 is outdated and should not be used for new learning.
Why does python not work but python3 does?
Some systems use python3 as the command name for Python 3. This is normal on many macOS and Linux setups.
What does Add Python to PATH mean?
It lets you run Python from the command line without typing the full installation folder path.
Do I need an IDE before learning Python?
No. You can start with the command line and a simple text editor, then move to an IDE later.
How do I know installation worked?
Run python --version or python3 --version, then open the Python shell and test a simple print statement.