appendix-e

Appendix E. Python setup

 

This section provides instructions for installing Python on Windows, Linux, and macOS, and setting up a virtual environment for managing project dependencies.

E.1 Installing Python on Linux

For most Linux distributions, Python can be installed using a package manager. For Ubuntu, follow these steps:

  1. Update your package manager:
sudo apt update
  1. Install Python using:
sudo apt install python3
  1. Create a symbolic link to use python instead of python3:
sudo ln -s /usr/bin/python3 /usr/bin/python
  1. Verify the installation by checking the version:
python --version

E.2 Installing Python on macOS

On macOS, Python can be installed using the Homebrew package manager. Follow these steps:

  1. Install Homebrew if it's not already installed by running:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  1. Use Homebrew to install Python:
brew install python
  1. Verify the installation by checking the version:
python --version

E.3 Installing Python on Windows

On Windows, Python can be installed through the following steps:

  1. Visit the official Python website: https://www.python.org/downloads/.
  2. Download the latest Python installer for Windows.
  3. Run the installer. Make sure to check the box that says: "Add Python to environment variables".
  4. Follow the installation instructions. Once installed, verify the installation by opening your terminal and running:
python --version
NOTE

This should display the version of Python installed, for example, Python 3.12.1.

E.4 Setting up a virtual environment

E.4.1 Creating a venv

E.4.2 Activating the venv

E.4.3 Deactivating the venv