python

On starting

First, we create and activate the virtual environment before installing the required packages.

 
python3 -m venv myvenv # Create
source venv/bin/activate # Activate

Once we have installed the required packages in the virtual environment for this project, we can generate the requirements.txt.

 
pip freeze > requirements.txt

When we are done working in the virtual environment, we can deactivate it.

deactivate

On using

To install the required packages listed in requirements.txt into virtual environment, we need to create and activate a virtual environment first and then install the packages.

python3 -m venv venv # Create
source venv/bin/activate # Activate
pip install -r requirements.txt # Install

On committing

Warning:

Normally, we would not commit the virtual environment to the repository. We would add it to .gitignore instead.