Here are steps that cover the basics nicely.
Extending on Pavel's answer this is how you create venv in python:
python -m venv myproject-venv
This will create a folder called myproject-venv in your current directory.
To answer your question, we can create this environment folder (Post venv command) anywhere on the system but for simplicity, this is created under the root folder of the project.
Post that we need to make sure that we include myproject-venv in .gitignore folder which will prevent it from committing the entire folder to the version-controlling system.
What usually goes into the source control is the requirements.txt file which includes all the dependency/packages you installed in virtual env mode. Think of this as an isolated mode where python is freshly being installed with no prior knowledge of any package.
Nicely written thread about requirements.txt:
Automatically create requirements.txt
Useful commands in venv (on Linux system)
Activate venv: source myproject-venv/bin/activate
Exit from venv: deactivate
(This command is available only when you are in venv)
Hope this helps. Thanks.