Skip to content

Python

Virtual environments are essentially local environments for Python so that you don’t install packages globally. It also lets you freeze version numbers so that you’re getting the same environment every time.

  • To create one: python3 -m venv venv
    • This will make a venv folder, which you should add to your .gitignore with a venv/ line.
  • To use one: source venv/bin/activate
    • After doing this, all of your installations will go into the local environment, e.g. packages will be installed in something like venv/lib/python3.11/site-packages.