Creating virtual environments
export venv1=/path/to/new/virtual/environment
python3 -m venv $venv1
Running this command creates the target directory (creating any parent directories that don’t exist already) and places a pyvenv.cfg
file in it with a home
key pointing to the Python installation from which the command was run (a common name for the target directory is .venv
). It also creates a bin
(or Scripts
on Windows) subdirectory containing a copy/symlink of the Python binary/binaries (as appropriate for the platform or arguments used at environment creation time). It also creates an (initially empty) lib/pythonX.Y/site-packages
subdirectory (on Windows, this is Lib\site-packages
). If an existing directory is specified, it will be re-used.
Activate virtual environments
source $venv1/bin/activate
Deactivate virtual environments
deactivate