Environment Configuration - CameronAuler/python-devops GitHub Wiki

Table of Contents

1. Installing Python on Windows

1.1 Download the latest installer

https://www.python.org/downloads/windows/

1.2 Run the Installer

  • Check the box for "Add Python to PATH" during the installation process.
  • Follow the on-screen instructions to complete the installation.

1.3 Verify Installation

python --version

or

py --version

2. Installing Python on MacOS

2.1 Download the latest installer

https://www.python.org/downloads/macos/

2.2 Open the DMG file and follow the installation prompts.

2.3 Add Python to PATH if needed (most installers automatically configure your PATH).

Using Homebrew (Recommended for Advanced Users)

1. Install Homebrew

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

2. Install Python via Homebrew

brew update
brew install python

3. Verify

python3 --version

3. Installing Python on Linux

3.1 Depending on your distribution, Python may already be installed. Check the current version

python3 --version

3.2 If not installed, use your distro’s package manager

  • Debian/Ubuntu
sudo apt-get update
sudo apt-get install python3 python3-pip
  • Fedora/Red Hat
sudo dnf install python3 python3-pip
  • Arch Linux
sudo pacman -S python python-pip

Virtual Environments (Recommended for Each Project)

1. Create a virtual environment

# For Python 3.x
(Windows) python -m venv myenv
(Mac/Linux) python3 -m venv myenv

2. Activate the environment

  • Windows
.\myenv\Scripts\activate
  • MacOS & Linux
source myenv/bin/activate

3. Deactivate the environment

deactivate