Virtual Environments
-
python3 -m venv name_of_venvCreates the virtual environment. -
source my_project/venv/bin/activate- Set up the virtual environment if it already exists -
pip freeze > requirements.txtOutput a version list that can be used to set up an environment -
pip install -r requirements.txt fileSet up a new environment based on the requirements file. -
deactivateTurns off the venv. -
python3 -m venv venv --system-site-packagesIncludes system packages in main environment in your new virtual environment. -
pip list --local- Shows just the packages that were installed. Not what was brought over
Don't put your project files into the venv.
Don't commit your venv files.