Sometimes the shell prompt doesn’t display the name of the virtual environment and you want to be sure if you are in a virtual environment or not.

Run the python interpreter and try:

import sys
sys.prefix
sys.real_prefix

For virtual environments created using the standard library venv module there is no sys.real_prefix. Instead, check whether sys.base_prefix is the same as sys.prefix.