Python Environment Setup on Mac, Windows, and Linux

Setting up Python on your system is the first step to getting started with Python programming. This guide covers installation and configuration for Mac, Windows, and Linux, along with setting up VSCode as your Python IDE.


1. Installing Python on Mac

Steps:

  1. Open the Terminal.
  2. Check if Python is pre-installed:
    python3 --version
    
    If Python is installed, it will display the version. If not, proceed to the next step.
  3. Download Python from the official Python website.
  4. Install Python using the downloaded installer.
  5. Verify installation:
    python3 --version
    
Info

Mac systems often come with Python pre-installed. However, it might not be the latest version.


2. Installing Python on Windows

Steps:

  1. Download Python from the official Python website.
  2. Run the installer.
    • Important: Check the box "Add Python to PATH" during installation.
  3. Verify installation:
    • Open Command Prompt and type:
      python --version
      
  4. Install pip, the Python package manager (if not pre-installed):
    python -m ensurepip --upgrade
    
Danger

If you forget to check "Add Python to PATH," you’ll need to manually add Python to your system environment variables.


3. Installing Python on Linux

Steps:

  1. Open the Terminal.
  2. Check if Python is pre-installed:
    python3 --version
    
  3. If not installed, use your package manager to install Python:
    • For Ubuntu/Debian:
      sudo apt update
      sudo apt install python3 python3-pip
      
    • For CentOS/Red Hat:
      sudo yum install python3
      
  4. Verify installation:
    python3 --version
    
Info

Linux distributions often include Python by default. Check your version to ensure it's up-to-date.


4. Setting Up Visual Studio Code (VSCode)

Installing VSCode

  1. Download VSCode from the official website.
  2. Install VSCode on your system.

Configuring Python in VSCode

  1. Open VSCode.
  2. Install the Python extension:
    • Go to the Extensions view (Ctrl+Shift+X or Cmd+Shift+X on Mac).
    • Search for "Python" and install the extension by Microsoft.
  3. Select the Python interpreter:
    • Open the Command Palette (Ctrl+Shift+P or Cmd+Shift+P on Mac).
    • Type Python: Select Interpreter and choose your installed Python version.
  4. Create a Python file:
    • Create a new file with a .py extension, e.g., hello.py.
    • Write your first program:
      print("Hello, Python!")
      
  5. Run the file:
    • Open the Terminal in VSCode (Ctrl+j or Cmd+j).
    • Run the file using:
      python3 hello.py
      

Congratulations! You have successfully set up Python on your system and configured VSCode as your IDE. You're now ready to dive into Python programming!"

Copyright © 2025 Devship. All rights reserved.

Made by imParth