Creating a Virtual Environment To create a virtual environment using Python use the following command: python -m venv <envname> To activate the environment, use the command: source env/bin/activate To deactivate or leave the environment, run the command: