How to Install Python on Windows, macOS, and Linux
Python is a powerful programming language used worldwide for web development, data science, automation, and much more. However, for beginners, installing the latest version or a specific version can sometimes be confusing.
In this detailed and beginner-friendly guide, we’ll walk you through installing Python on Windows, macOS, and Linux. Whether it’s your first time or you’re updating to a specific version, this guide will help you get started easily!
How to Install Python on Windows
Step 1: Download the Installer
- Visit the official Python website: python.org/downloads.
- Click the Download button for the latest version. For a specific version, click View the full list of downloads and choose the desired version.
Step 2: Run the Installer
- Go to your
Downloads
folder and double-click the file (e.g.,python-3.x.x.exe
). - On the first screen, check the box Add Python to PATH—this is crucial for using Python via the command line.
- Click Install Now to start the installation.
Step 3: Verify the Installation
- Open the Command Prompt (
Win + R
, typecmd
, and press Enter). - Type:
python --version
This command should display the installed version.
Step 4: Install a Specific Version
- Download the specific version from the Python website.
- Follow the same steps as above, ensuring you uninstall any existing versions first if necessary.
How to Install Python on macOS
Step 1: Check the Pre-Installed Version
macOS comes with Python pre-installed, but it may not be the latest version. To check, open the Terminal (Cmd + Space
, type Terminal
) and run:
python3 --version
Step 2: Download Python
- Visit python.org/downloads and download the latest version for macOS.
- For a specific version, choose it from the list of available versions.
Step 3: Install Python
- Locate the
.pkg
file in yourDownloads
folder and double-click it. - Follow the on-screen instructions in the installation wizard.
Step 4: Configure Python in the Terminal
- If the correct version is displayed, the installation was successful.
How to Install Python on Linux
Step 1: Check the Current Version
- Open the terminal (
Ctrl + Alt + T
). - Run:
python3 --version
Step 2: Update Repositories
Before installing, ensure your system is up to date:
- For Debian-based systems (Ubuntu, Mint):
sudo apt update && sudo apt upgrade -y
- For Fedora:
sudo dnf update -y
- For Arch/Manjaro:
sudo pacman -Syu
Step 3: Install the Latest Version
- For Ubuntu/Debian:
sudo apt install python3
- For Fedora:
sudo dnf install python3
- For Arch Linux:
sudo pacman -S python
Step 4: Install a Specific Version
- Download the desired version’s source code from python.org/downloads.
- Extract and compile it:
tar xvf Python-3.x.x.tgz
cd Python-3.x.x
./configure
make
sudo make install
Step 5: Verify the Installation
Run the following command in the terminal:
python3 --version
Troubleshooting Tips
- PATH Error (Windows): Ensure the Add Python to PATH option was checked during installation.
- Permission Issues (Linux): Use
sudo
for commands requiring administrative rights.
Conclusion
Now you know how to install Python on Windows, macOS, and Linux! Whether you’re just starting with programming or need a specific version for a project, this guide ensures a smooth installation process.
If you have any question, doubt or advice, please leave your comment.
For more details, visit the official Python documentation. Happy coding! 😊