|
| Home |
|---|
Before you can start writing Python programs, you need to install the Python programming language on your computer. Python is available for Windows, macOS and Linux, and the installation process is straightforward for beginners.
This guide explains how to install Python step by step on Windows, macOS and Linux. You will also learn how to check whether Python is already installed, verify the installation, run your first Python program and solve common Python installation problems.
Whether you are learning Python for school, university, programming, data science, automation, web development or machine learning, installing Python correctly is the first step.
The best place to download Python is the official Python website. The official website provides Python installers and downloads for different operating systems.
Download Python from the official website
Always download Python from the official Python website or another trusted source. Avoid downloading Python installers from unknown third-party websites.
Before installing Python, you can check whether Python is already installed on your computer.
The command you use depends on your operating system.
Open Command Prompt or PowerShell and enter:
python --version
You can also try:
py --version
Open the Terminal application and enter:
python3 --version
Open a terminal and enter:
python3 --version
If a Python version is displayed, Python is already available through that command. If the command is not found, continue with the installation instructions below.
Windows users can install Python using the official Python installation tools. The current Python installation process is designed to make it easy for beginners to install Python and start running Python programs.
Go to the official Python downloads page and select the Windows download:
Open the downloaded Python installer and follow the instructions shown on the screen.
Allow the installation process to complete. If Windows asks for administrator permission, approve the installation.
Open Command Prompt or PowerShell and enter:
python --version
You can also check the Python launcher:
py --version
If the installation was successful, Windows will display the installed Python version.
The PATH environment variable allows Windows to find programs when you enter commands in Command Prompt or PowerShell.
If Python is available through your PATH, you can run:
python
This starts the Python interpreter.
If Windows reports that Python cannot be found, check your Python installation and PATH configuration. After changing environment variables, close and reopen Command Prompt or PowerShell before testing again.
Python can be installed on a Mac using the official Python installer.
The official macOS installer is provided as a .pkg file.
Visit the official Python macOS downloads page:
After downloading Python, locate the .pkg installer and
double-click it.
The macOS installation wizard will guide you through the installation.
Follow the instructions displayed by the installer. Click Continue when prompted and allow the installation to finish.
Open Terminal and enter:
python3 --version
If Python has been installed correctly, Terminal will display the installed Python 3 version.
Many Linux distributions already include Python 3 or provide it through their package manager. The exact installation command depends on the Linux distribution you are using.
Ubuntu uses the apt package manager. First update the
package information:
sudo apt update
Then install Python 3:
sudo apt install python3
After installation, verify Python:
python3 --version
Debian also uses the apt package manager.
sudo apt update
sudo apt install python3
Check the installation:
python3 --version
Fedora uses the dnf package manager.
sudo dnf install python3
Verify the installation:
python3 --version
Arch Linux uses the pacman package manager. Python can be
installed using:
sudo pacman -S python
Verify Python:
python --version
After installing Python, it is important to verify that the Python interpreter is working correctly.
python --version
python3 --version
A successful installation should display a Python 3 version number.
You can find the location of the Python executable on your computer. This is particularly useful if you have more than one Python installation.
where python
which python3
Once Python is installed, you can start the Python interpreter directly from the command line.
python
python3
You can then enter Python commands directly into the interpreter. For example:
print("Hello Python")
After installing Python, create a file named hello.py and add the following code:
print("Hello, World!")
Save the file as hello.py.
Open Command Prompt, move to the folder containing the file and run:
python hello.py
python3 hello.py
Hello, World!
pip is the package installer commonly used with Python. It allows programmers to install additional Python packages and libraries.
For example, developers use Python packages for data analysis, automation, web development, machine learning and many other applications.
python -m pip --version
python3 -m pip --version
After pip is available, you can install a package using the
install command.
python -m pip install requests
python3 -m pip install requests
When working on Python projects, it is good practice to use a virtual environment. A virtual environment provides an isolated environment for a project and helps prevent conflicts between package versions.
Python includes the built-in venv module for creating
virtual environments.
python -m venv .venv
python3 -m venv .venv
If Windows reports that Python cannot be found, first try:
py --version
If the py command works but python does not,
check your Python installation and PATH configuration.
If the python3 command is not available, Python 3 may not
be installed or may not be available through your system PATH.
On Ubuntu or Debian, you can install Python using:
sudo apt update
sudo apt install python3
It is possible to have more than one Python version installed on a computer. This can sometimes cause confusion about which Python interpreter is being used.
On Windows, check:
python --version
where python
On macOS and Linux, check:
python3 --version
which python3
| Task | What to Do |
|---|---|
| Download Python | Download Python from the official Python website. |
| Install Python | Follow the installation instructions for your operating system. |
| Verify Python | Run the Python version command. |
| Test Python | Run a simple Python program. |
| Check pip | Verify that pip is available. |
| Learn Python | Start with Python syntax, variables, data types and operators. |
Download Python from the official Python website and follow the installation instructions for Windows, macOS or Linux. After installation, verify Python using the appropriate version command.
Python can be downloaded from the official Python website: python.org .
Download the Windows Python installer or installation tool from the
official Python website, complete the installation and verify it using
python --version or py --version.
Download the official macOS Python installer, open the
.pkg file and follow the installation instructions.
After installation, use python3 --version in Terminal
to verify Python.
Ubuntu users can normally install Python 3 through the apt package manager:
sudo apt update
sudo apt install python3
On Windows, use python --version or
py --version. On macOS and Linux, use
python3 --version.
After installing Python, start with the basic Python concepts such as syntax, variables, data types, input and output, operators, comments and indentation. You can then move on to lists, dictionaries, functions and other Python programming topics.
Once Python is installed, continue with the fundamental Python topics in this tutorial:
Installing Python is the first step toward learning Python programming. Python can be installed on Windows, macOS and Linux using the appropriate installation method for each operating system.
After installation, verify Python by checking its version and run a
simple program such as print("Hello, World!"). Once Python
is working correctly, you can begin learning Python syntax, variables,
data types, operators, functions and other programming fundamentals.
Struggling with Python syntax, assignments or debugging errors? Learning alone can be frustrating.
Get 1-on-1 Python tutoring and learn faster with clear explanations, real examples and live help.
Home Tutorial Online Live Trainings Contact Us © 2026 All rights reserved by www.PythonTutor.net