Installing Python
Installing Python is the first step in your programming journey. Whether you're using Windows, macOS, or Linux, you can easily download and install the latest version of Python 3 by following a few simple steps.
Python is free and open-source software distributed under the Python Software Foundation License (PSF License). You can download the official installer from the Python website. Many operating systems, especially Linux distributions, also include Python in their package repositories, allowing you to install it directly using the system's package manager.
Check if Python is Already Installed
Before installing Python, check whether it is already available on your system.
Windows
Open Command Prompt and run:
python --version
or
py --version
macOS and Linux
Open Terminal and run:
python3 --version
If a version number appears, Python is already installed.
Installing Python on Windows
Step 1: Download Python
Visit the official Python website and download the latest stable version:
https://www.python.org/downloads/
Step 2: Run the Installer
Double-click the downloaded installer file.
Step 3: Enable PATH
Before clicking "Install Now", check:
Add Python to PATH
This allows you to run Python from any command prompt.
Step 4: Install Python
Click:
Install Now
Wait for the installation to complete.
Step 5: Verify Installation
Open Command Prompt and run:
python --version
Example output:
Python 3.13.0
Installing Python on macOS
Using the Official Installer
- Download Python from the official website.
- Open the downloaded package.
- Follow the installation wizard.
- Complete the installation.
Verify installation:
python3 --version
Installing Python on Linux
Ubuntu/Debian
Update package lists:
sudo apt update
Install Python:
sudo apt install python3
Verify installation:
python3 --version
Fedora
sudo dnf install python3
Arch Linux
sudo pacman -S python
Running Your First Python Program
Create a file named:
hello.py
Add the following code:
print("Hello, World!")
Save the file and run:
Windows
python hello.py
macOS/Linux
python3 hello.py
Output:
Hello, World!
Congratulations! You've successfully installed Python and executed your first Python program.
Installing pip
pip is Python's package manager used to install third-party libraries.
Check pip version:
pip --version
or
pip3 --version
Install a package:
pip install requests
Common Installation Issues
Python Command Not Found
If you receive:
'python' is not recognized as an internal or external command
Python may not be added to PATH. Reinstall Python and ensure "Add Python to PATH" is selected.