---
tags:
  - macOS
  - Tahoe
  - python
  - development
  - programming
title: Setting up Python on macOS Tahoe
---

# Setting up Python on macOS Tahoe

macOS Tahoe is an excellent platform for Python development. While the system may include a version of Python for its own use, it is highly recommended to install a separate version for development to avoid conflicting with system tools.

This guide relies on Homebrew for installation. If you haven't set it up yet, please see [Package Management with Homebrew on macOS Tahoe](homebrew.md).

## Installing Python

The easiest way to install the latest version of Python is via Homebrew.

1.  Open your terminal.
2.  Run the installation command:

```zsh
brew install python
```

3.  Verify the installation:

```zsh
python3 --version
pip3 --version
```

## Virtual Environments

It is best practice to use virtual environments for your projects. This keeps dependencies required by different projects separate.

### Creating a Virtual Environment

Navigate to your project directory and run:

```zsh
python3 -m venv venv
```

This creates a folder named `venv` in your directory containing a standalone Python installation.

### Activating the Environment

To start using the virtual environment:

```zsh
source venv/bin/activate
```

Your terminal prompt should now show `(venv)`, indicating that you are working inside the isolated environment.

### Deactivating

To exit the virtual environment and return to the global Python context:

```zsh
deactivate
```

## Managing Packages with Pip

Once your virtual environment is active, you can install packages using `pip`.

```zsh
pip install requests
```

To save your project's dependencies to a file:

```zsh
pip freeze > requirements.txt
```

To install dependencies from a file:

```zsh
pip install -r requirements.txt
```