Notepad/enter/Coding Tips (Classical)/Terminal Tips/Languages/Python/tools/Environments/Venv/Venv.md

1.3 KiB
Raw Blame History

Apparently venv is the way that Python suggests (Pythonvenv module ) to create virtual environments. This module is part of Pythons standard library, and its the officially recommended way to create virtual environments since Python 3.5.

Note: There are other great third-party tools for creating virtual environments, such as conda and virtualenv. Any of these tools can help you set up a Python virtual environment.

For basic usage, venv is an excellent choice because it already comes packaged with your Python installation. With that in mind, youre ready to create your first virtual environment.


Create a virtual environment

To make a new virtual environment with venv simply:

  1. head to your project folder or make one
mkdir project_folder # this makes a project folder
cd project_folder # head to your project folder
  1. create a new venv environment
python -m venv env_name
  1. activate the environment
source env_name/bin/activate
  1. deactivate when done
deactivate