# Python Installation and Setup

## 1. Check if Python is Installed

Open your terminal or command prompt and run:

```bash
python --version
# or
python3 --version
```

If you see a version number (e.g., `Python 3.11.x`), Python is already installed.

## 2. Installing Python

### Windows

1.  Go to python.org/downloads.
2.  Download the latest version for Windows.
3.  Run the installer.
4.  **Crucial Step**: Ensure you check the box **"Add Python to PATH"** at the bottom of the installer window before clicking "Install Now". This allows you to run Python from the command prompt.

### macOS

**Using Homebrew (Recommended):**

```bash
brew install python
```

**Using Installer:**
Download the macOS installer from python.org and follow the prompts.

### Linux (Ubuntu/Debian)

Python 3 is usually pre-installed. To install or update:

```bash
sudo apt update
sudo apt install python3 python3-pip
```

## 3. Package Management (pip)

`pip` is the standard package manager for Python. It is included by default with Python versions 3.4+.

```bash
# Check version
pip --version

# Install a package
pip install requests
```

## 4. Virtual Environments

It is best practice to use virtual environments to isolate project dependencies. See the [[programming/python/modules/venv-module|venv module]] note for details on creating and activating environments.

[[programming/python/python]]