Skip to main content

Python Virtual Environment

Virtual Environment Establishment and Usage Tutorial

  • Download virtualenv (skip if already installed):

    pip3 install virtualenv
  • Create a virtual environment in the directory of the application that needs it:

    python3 -m virtualenv .venv
  • Activate the virtual environment:

    source .venv/bin/activate
  • Update pip3 in the virtual environment:

    pip3 install --upgrade pip
  • Deactivate the virtual environment:

    deactivate
  • Delete the virtual environment:

    rm -rf .venv