danielljeon.github.io

Python Development Environment


Table of Contents

1 Overview

This document provides instructions for installing and setting up Python to begin working with other IDEs and development environments.


2 Windows

2.1 Install

2.1.1 Python

Install python directly from the official website: Python downloads.

It is highly recommended to select/allow the set environment variable ( might be slightly different wording) setting for system-wide activation.

2.2 Manual Virtual Environment Creation

python -m venv /path/to/new/virtual/environment  # Create venv.

For official docs, see: https://docs.python.org/3/library/venv.html#module-venv.


3 macOS

3.1 Install

The following documentation is based on recommendations, there are multiple methods for installation.

3.1.1 Homebrew

See homebrew.md.

3.1.2 pyenv

github.com/pyenv/pyenv.

brew install pyenv  # Install pyenv.

3.1.3 Python via pyenv

pyenv install 3.12.3  # Install python version 3.12.3.
pyenv uninstall 3.12.3  # Uninstall python version.

pyenv global 3.12.3  # Set version for active global use.
pyenv local 3.12.3  # Set version for active local use.
pyenv shell 3.12.3  # Set version for active shell use.
# Activation levels from highest to lowest is: global, local, shell.

pyenv version  # Show current active python version.

pyenv versions  # Show all installed python versions.
# The * points to the version currently active.

pyenv which python  # Show current active python location.

3.2 Manual Virtual Environment Creation

ls  # Move to the target venv location.

pyenv virtualenv <python_version> <environment_name>  # Create venv.

pyenv local <environment_name>  # Activate venv as the local environment.

pyenv which python  # Verify active python venv location.
pyenv which pip  # Verify active pip (part of venv) location.

pyenv activate <environment_name>  # Manually activate venv (if using multiple).
pyenv deactivate  # Deactivate current venv.