Skip to main content

Use a Python virtual environment

·
Table of Contents

Introduction
#

Belkast makes use of the Python modules listed below and, to make it easy to configure and ensure we always get the latest version, a Python virtual environment (venv) is set up.

ZSH
#

The zsh configuration to assist with setting up the Python virtual environment is shown below.

py_i function
#

function py_i() {
  if [[ "$1" =~ ^.+$ ]] then;
    cd "$HOME/Documents"
    mkdir -p python3/venv
    cd "python3/venv"
    python3 -m venv $1
    cd $1
    echo $SHELL
    source bin/activate
  else
    echo "Directory is required!"
  fi
}

py_d alias
#

alias py_d="deactivate"