๐ง Complete Python Installation Guide
Step-by-step instructions for Windows, macOS, and Linux
๐ Table of Contents
๐ช Windows Installation
Method 1: Official Python Installer (Recommended)
Step 1: Download Python
- Visit python.org/downloads
- Click "Download Python 3.x.x" (latest version)
- Save the installer (e.g.,
python-3.11.5-amd64.exe)
Step 2: Run Installer
โ ๏ธ IMPORTANT: Check "Add Python to PATH"
- Double-click the installer
- โ Check "Add Python 3.x to PATH" (bottom of window)
- Click "Install Now"
- Wait for installation
- Click "Close"
Step 3: Verify Installation
Open Command Prompt (Win + R, type cmd, press Enter):
python --versionExpected: Python 3.11.x
Method 2: Microsoft Store (Easiest)
- Open Microsoft Store
- Search "Python 3.11"
- Click "Get" or "Install"
- Wait for automatic installation
โ Advantages: Automatic PATH setup, automatic updates
Adding Python to PATH (If Missed)
If you forgot to check "Add to PATH":
- Search for "Environment Variables" in Start menu
- Click "Environment Variables" button
- Under "System variables", select "Path", click "Edit"
- Click "New" and add:
C:\Users\YourUsername\AppData\Local\Programs\Python\Python311C:\Users\YourUsername\AppData\Local\Programs\Python\Python311\Scripts
- Click "OK" on all windows
- Restart Command Prompt and test
๐ macOS Installation
Method 1: Official Python Installer (Recommended)
Step 1: Download Python
- Visit python.org/downloads
- Click "Download Python 3.x.x"
- Download the
.pkginstaller
Step 2: Install
- Double-click the
.pkgfile - Follow installation wizard
- Enter password when prompted
- Click "Close"
Step 3: Verify
Open Terminal (โ + Space, type "Terminal"):
python3 --versionExpected: Python 3.11.x
Method 2: Homebrew (For Advanced Users)
If you have Homebrew installed:
# Install Homebrew if not installed
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install Python
brew install python@3.11๐ง Linux Installation
Most Linux distributions come with Python pre-installed. Check first:
python3 --versionUbuntu/Debian
sudo apt update
sudo apt install python3.11 python3-pipFedora/RHEL/CentOS
sudo dnf install python3.11 python3-pipArch Linux
sudo pacman -S python python-pipโ Verify Your Installation
Check Python Version
Windows:
python --versionmacOS/Linux:
python3 --versionExpected output: Python 3.11.x or higher
Check pip (Package Installer)
Windows:
pip --versionmacOS/Linux:
pip3 --versionExpected output: pip 23.x.x from ...
Test Python Interactive Mode
Windows:
pythonmacOS/Linux:
python3You should see:
Python 3.11.5 (main, Sep 11 2023, 13:54:46)
[GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>Type print("Hello, World!") and press Enter. You should see output.
Type exit() to leave interactive mode.
๐ง Troubleshooting
Problem: "python is not recognized" (Windows)
Solution 1: Use Python Launcher
py --version
py your_script.pySolution 2: Add to PATH
See "Adding Python to PATH" section above.
Solution 3: Reinstall Python
- Uninstall Python (Settings โ Apps)
- Reinstall, ensuring "Add to PATH" is checked
Problem: "command not found: python" (macOS/Linux)
Solution: Use python3 instead:
python3 --version
python3 your_script.pyTo make python work (optional):
# Check where python3 is
which python3
# Create alias (add to ~/.bashrc or ~/.zshrc)
alias python=python3
alias pip=pip3Problem: Multiple Python Versions Installed
Check all versions:
# Windows
py -0
# macOS/Linux
python3 --version
python3.11 --version
python3.10 --versionUse specific version:
# Windows
py -3.11 your_script.py
# macOS/Linux
python3.11 your_script.pyProblem: Permission Denied (Linux/macOS)
When running scripts:
chmod +x your_script.py
./your_script.pyOr use:
python3 your_script.pyProblem: pip Not Working
Install pip manually:
Windows:
python -m ensurepip --upgrademacOS/Linux:
python3 -m ensurepip --upgrade๐ป Setting Up Your Editor
Visual Studio Code (Recommended)
1. Download
- Visit code.visualstudio.com
- Download for your OS
- Install following prompts
2. Install Python Extension
- Open VS Code
- Click Extensions (Ctrl+Shift+X or Cmd+Shift+X)
- Search "Python"
- Install "Python" by Microsoft
3. Configure Python Interpreter
- Open Command Palette (Ctrl+Shift+P or Cmd+Shift+P)
- Type "Python: Select Interpreter"
- Choose Python 3.11 or higher
4. Test It
- Create new file:
test.py - Write:
print("VS Code works!") - Click Run button (top right) or press F5
PyCharm (Alternative)
1. Download
- Visit jetbrains.com/pycharm/download
- Download Community Edition (free)
- Install
2. Create Project
- Open PyCharm
- New Project โ Select Python 3.11
- Create
3. Run Code
- Right-click Python file โ Run
Other Editors
- Sublime Text: Lightweight, fast
- Atom: GitHub's editor, hackable
- Jupyter Notebook: Great for data science (install with
pip install jupyter) - IDLE: Comes with Python, basic but functional
๐ Virtual Environments (Optional but Recommended)
Keep project dependencies separate:
Create virtual environment:
# Windows
python -m venv myenv
myenv\Scripts\activate
# macOS/Linux
python3 -m venv myenv
source myenv/bin/activateDeactivate:
deactivate๐งช Testing Your Complete Setup
Create a file setup_test.py:
import sys
import platform
print("=" * 50)
print("Python Installation Test")
print("=" * 50)
print(f"Python Version: {sys.version}")
print(f"Platform: {platform.system()} {platform.release()}")
print(f"Python Executable: {sys.executable}")
print("=" * 50)
print("โ
Everything is working correctly!")
print("=" * 50)Run it:
python setup_test.py # Windows
python3 setup_test.py # macOS/LinuxExpected output:
==================================================
Python Installation Test
==================================================
Python Version: 3.11.5 (main, Sep 11 2023...)
Platform: Windows 10
Python Executable: C:\Users\...\python.exe
==================================================
โ
Everything is working correctly!
==================================================๐ Next Steps
- โ Python installed and verified
- โ pip working
- โ Editor set up
- โ Test script runs successfully
You're ready to code! ๐
๐ Quick Reference Commands
| Task | Windows | macOS/Linux |
|---|---|---|
| Run Python | python script.py | python3 script.py |
| Python version | python --version | python3 --version |
| Install package | pip install package | pip3 install package |
| Interactive mode | python | python3 |
| Run with py launcher | py script.py | N/A |
Installation guide last updated: December 2025