1.
Setting up Python on Windows
Step 1: Download Python Installer
● Go to the official Python website.
● Download the latest version of Python for Windows (recommended the stable version).
Step 2: Run the Installer
● Run the downloaded Python installer.
● Important: Check the box labeled “Add Python to PATH” (this allows Python to be run
from the command line).
● Click on Customize Installation to choose the features or just select Install Now.
Step 3: Verify Installation
● Open Command Prompt.
● Type python --version or python and hit Enter. This should display the Python
version.
Step 4: Install pip (Package Installer)
● Python 3.4 and above includes pip by default.
To check if pip is installed, run:
pip --version
If not installed, you can install it using:
python -m ensurepip --upgrade
Step 5: Set Environment Variables (if needed)
● If you missed adding Python to the PATH during installation:
○ Go to Control Panel > System > Advanced System Settings.
○ Click on Environment Variables.
○ Find Path in system variables and click Edit.
○ Add the path where Python is installed (e.g., C:\Python39\).
Step 6: Install IDE or Text Editor
● Download and install an IDE or text editor (like VS Code, PyCharm, or Sublime Text).
2. Setting up Python on Linux
Step 1: Update Package Index
Open a terminal and run the following to update the package list:
sudo apt update
Step 2: Install Python
For Ubuntu/Debian-based distributions:
sudo apt install python3
For Red Hat/CentOS-based distributions:
sudo yum install python3
Step 3: Verify Installation
Check the installed Python version:
python3 --version
Step 4: Install pip (Package Installer)
Install pip by running:
sudo apt install python3-pip
Verify pip installation:
pip3 --version
Step 5: Set up Virtual Environment (Optional)
Install virtual environment:
sudo apt install python3-venv
Create a virtual environment:
python3 -m venv myenv
Activate it:
source myenv/bin/activate
Step 6: Install IDE or Text Editor
● Use an IDE or text editor like VS Code, PyCharm, Sublime, or Vim.
3. Setting up Python on macOS
Step 1: Check if Python is Pre-installed
Open Terminal and check for Python:
python3 --version
● macOS comes with Python 2.x pre-installed. To install Python 3.x, follow the next steps.
Step 2: Install Homebrew (Package Manager)
If you don’t have Homebrew, install it by running:
/bin/bash -c "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Step 3: Install Python Using Homebrew
Run the following command to install Python:
brew install python
Step 4: Verify Installation
Check Python version:
python3 --version
Check pip:
pip3 --version
Step 5: Set up Virtual Environment (Optional)
Create and activate a virtual environment:
python3 -m venv myenv
source myenv/bin/activate
Step 6: Install IDE or Text Editor
● Download and install an IDE or text editor like VS Code, PyCharm, or Sublime Text.