Python

Virtual Environment

Create Virtual Environment

To create a virtual environment execute the following command:

python3 -m venv .venv

This will create a new folder .venv in the current working directory containing the virtual environment with the Python interpreter and pip pre-installed.

Activate Virtual Environment

To use the newly created virtual environment execute one of the following commands based on the shell you are using:

python3 -m pip install --upgrade pip wheel setuptools

python3 -m pip install PyContracts pytest

Requirements Files

Create Requirements Files

python3 -m pip freeze > requirements.txt

Install From Requirements File

python3 -m pip install -r requirements.txt

References