Nearby lessons
2 of 159Python - Installation
- Learn how to download Python from the official website
- Install Python on your computer step by step
- Understand the importance of adding Python to PATH
- Verify that Python is installed correctly
Introduction
Before you can write Python programs, you need to install Python on your computer.
Don't worry — the installation is very simple and takes only a few minutes.
In this lesson, you will learn how to download, install, and verify Python on Windows step by step.
Before Installing Python
First check whether Python is already installed on your computer.
- Open the Command Prompt.
- Type the following command:
pythonIf Python is already installed, Python starts or its version is displayed.
If you see a message like 'python' is not recognized as an internal or external command...,
it means Python is not installed on your computer.
Official Python Website
Always download Python from the official website.
Website:
This website is maintained by the Python Software Foundation.
From this website, you can:
- Download Python
- Read the official documentation
- Learn about Python
- Download the latest Python versions
Python Versions
When you visit the Python website, you will find different Python versions.
The two main versions are:
- Python 2
- Python 3
These are two different versions of Python.
Python 2 vs Python 3
Python has had two major versions — Python 2 and Python 3. Python 2 reached its end of life on January 1, 2020 and is no longer maintained.
All modern Python development should use Python 3. When you download Python from the official website, you will always get the latest Python 3 release.
Supported Operating Systems
Python is available for different operating systems.
- Windows
- macOS
- Linux
- Other platforms
In this tutorial, we will install Python on Windows.
Step 1 - Open the Official Python Website
Open your web browser.
Go to the official Python website:
This website is maintained by the Python Software Foundation.
Always download Python from this official website.
Step 2 - Open the Downloads Page
On the home page, you will see different menu options.
- Downloads
- Documentation
- Community
- About
Move the mouse over the Downloads menu.
The website automatically shows the latest Python version available for your operating system.
Step 3 - Select Your Operating System
Python is available for different operating systems.
- Windows
- macOS
- Linux
- Other Platforms
Choose the installer for your operating system.
In this tutorial, we are using the Windows version.
Step 4 - Download Python
Click the download button to start downloading Python.
The website downloads the latest stable version available.
The installer file is small, so the download usually finishes quickly.
Step 5 - Run the Python Installer
After downloading, open the Downloads folder.
Double-click the downloaded Python installer.
The Python Setup window will open.
Important Step - Add Python to PATH
Before clicking Install Now, look for the following checkbox at the bottom of the installer window:
Add Python to PATH
What is PATH?
PATH is a list of folders that Windows checks when you type a command. If Python is added to PATH, Windows can find Python automatically.
If you do not select this checkbox, you may see this error later:
'python' is not recognized as an internal or external commandStep 6 - Install Python
After selecting Add Python to PATH, click Install Now.
The installer will automatically install the required components.
- Python Interpreter
- IDLE
- pip (Package Manager)
- Python Documentation
- Shortcuts
- File Associations
No manual configuration is required.
Step 7 - Installation Process
The installer copies all the required files to your computer.
Wait until the installation is completed.
After installation, you will see a success message similar to:
Setup was successful.Click Close to finish the installation.
Step 8 - Verify the Installation
After installing Python, check whether it is installed correctly.
- Open the Start Menu.
- Type Python.
You should see programs such as:
- Python 3.x
- IDLE
- Python Documentation
This confirms that Python has been installed successfully.
Verify Using Command Prompt
You can also verify the installation using the Command Prompt.
Open Command Prompt and type:
Expected output:
Alternative Command
If the above command does not work, try:
Expected output:
Installation Tips
- Always download Python from the official website.
- Always install the latest Python 3 version.
- Do not forget to select Add Python to PATH.
- Use Install Now unless you need a custom installation.
- Verify the installation after it is completed.
What is PATH?
After installing Python, one important thing is the PATH environment variable.
PATH tells Windows where installed programs are located.
When you type a command in the Command Prompt, Windows checks the folders listed in PATH to find the required program.
If Python is added to PATH, you can run Python from any folder without typing its installation location.
Why is PATH Required?
Suppose you open the Command Prompt and type:
pythonWindows searches for python.exe using the folders stored in the PATH environment variable.
How PATH Works
When you run a command, Windows follows these steps:
- Read the command you entered.
- Search every folder listed in the PATH environment variable.
- If the program is found, Windows starts it.
- If the program is not found, Windows shows an error message.
For the python command, Windows looks for the file python.exe.
If python.exe is available in one of the PATH folders, Python starts successfully.
What Happens if PATH is Not Set?
If Python is not added to PATH, Windows cannot find python.exe.
In that case, Python commands will not work from the Command Prompt.
You may see an error message similar to this:
'python' is not recognized as an internal or external command,
operable program or batch file.How Python Automatically Adds PATH
During installation, Python provides the option:
Add Python to PATH
If you select this option, the installer automatically adds the Python installation folder to the PATH environment variable.
You do not need to configure PATH manually.
This makes it easy to run Python commands from any folder.
Python vs Java PATH Setup
Many programming languages require manual PATH configuration.
For example, in Java, you usually need to set the JDK PATH manually.
In Python, this work is done automatically if you select Add Python to PATH during installation.
This makes Python installation easier for beginners.
Checking the PATH Environment Variable
You can check whether Python has been added to PATH.
- Open the Start Menu.
- Search for Environment Variables.
- Open Edit the system environment variables.
- Click Environment Variables.
- Select the Path variable.
- Click Edit.
If Python is installed correctly, you will see the Python installation folders listed in the PATH variable.
Benefits of Adding Python to PATH
- Run Python from any folder.
- No need to type the full installation path.
- Python commands work directly in the Command Prompt.
- Tools like pip also work easily.
- Python development becomes faster and easier.
Important Note
Always select Add Python to PATH during installation.
This saves time and avoids command errors in the future.
- Always download Python from python.org — the official website
- Always install the latest Python 3 version
- Check the "Add Python to PATH" checkbox during installation — this is very important
- Use python --version or py --version to verify installation