Installing Python and Setting Up Environment on Windows, Linux, and Mac

3/22/2025

Python programming language logo - Installation guide for Windows, Linux, and Mac

Go Back

Installing Python and Setting Up Environment on Windows, Linux, and Mac – Step-by-Step Guide

Python is one of the most popular programming languages, widely used for web development, data science, AI, automation, and more. Setting up Python correctly on your system is the first step toward starting your coding journey. In this guide, we will walk you through the process of installing Python and setting up the environment on Windows, Linux, and Mac.

Python programming language logo - Installation guide for Windows, Linux, and Mac

Why Install Python?

  • Open-source and free to use
  • Easy to learn and widely used in multiple industries
  • Supports a vast range of libraries and frameworks
  • Cross-platform compatibility (Windows, Linux, macOS)

Installing Python on Windows

Step 1: Download Python Installer

  1. Visit the official Python website: https://www.python.org/downloads/
  2. Click on the latest version available for Windows.
  3. Download the .exe installer (64-bit recommended).

Step 2: Install Python

  1. Run the downloaded installer.
  2. Important: Check the box "Add Python to PATH" before clicking "Install Now."
  3. Wait for the installation to complete, then click "Close."

Step 3: Verify Installation

  1. Open Command Prompt (cmd).
  2. Type the following command:
    python --version
    
  3. If Python is installed correctly, you will see the version number displayed.

Step 4: Set Up Virtual Environment (Optional but Recommended)

A virtual environment allows you to manage dependencies efficiently.

pip install virtualenv
virtualenv my_env
my_env\Scripts\activate

To deactivate, use:

deactivate

Installing Python on Linux

Step 1: Update System Packages

Before installing Python, update the package list:

sudo apt update && sudo apt upgrade -y

Step 2: Install Python

Ubuntu/Debian-based systems:

sudo apt install python3 python3-pip -y

Fedora:

sudo dnf install python3

Arch Linux:

sudo pacman -S python

Step 3: Verify Installation

python3 --version

Step 4: Set Up Virtual Environment

sudo apt install python3-venv
python3 -m venv my_env
source my_env/bin/activate

To deactivate:

deactivate

Installing Python on Mac

Step 1: Install Homebrew (If Not Installed)

Homebrew is a package manager for macOS. Install it using:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Step 2: Install Python

brew install python

Step 3: Verify Installation

python3 --version

Step 4: Set Up Virtual Environment

python3 -m venv my_env
source my_env/bin/activate

To deactivate:

deactivate

Conclusion

Setting up Python correctly is essential for a smooth development experience. This guide has covered installation steps for Windows, Linux, and Mac, along with setting up a virtual environment to manage dependencies. Start coding today and explore the endless possibilities Python has to offer!

Stay updated with more tutorials on DeveloperIndian Blog

Table of content