# 🐍 Python 3.12 Setup Guide

### 🔹 macOS Installation

#### ✅ Method 1: Using Homebrew (Recommended)

1. Install Homebrew (if not already installed):

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

2. Update Homebrew:

```
brew update
```

3. Install Python 3.12:

```
brew install python@3.12
```

4. Link Python 3.12 (Optional if multiple Python versions installed):

```
brew link python@3.12 --force
```

5. Verify Installation:

```
python3 --version
```

***

#### ✅ Method 2: From Official Installer

1. Download: Visit the official page:

   <https://www.python.org/downloads/mac-osx/>
2. Install: Run the .pkg installer and follow instructions.
3. Verify:

```
python3.12 --version
```

4. (Optional) Add to path if python3.12 not recognized:

```
export PATH="/Library/Frameworks/Python.framework/Versions/3.12/bin:$PATH"
```

***

### 🔹 Windows Installation

#### ✅ Using Official Installer

1. Download:

   Go to <https://www.python.org/downloads/windows/>
2. Run Installer:
   * Check: ✅ “Add Python 3.12 to PATH”
   * Click “Customize installation” (recommended) or “Install Now”
3. During install:
   * Optionally enable pip, tcl/tk, IDLE, and Add Python to environment variables
4. Verify Installation:

   Open Command Prompt (Win + R → cmd) and run:

```
python --version
```

***

### ✅ Post-Installation (All OS)

1. Check pip:

```
pip --version

```

2. Upgrade pip (Optional):

```
python -m pip install --upgrade pip

```

3. Set Up Virtual Environment:

```
python -m venv myenv
source myenv/bin/activate     # macOS/Linux
.\myenv\Scripts\activate      # Windows

```
