To create a virtual environment, go to your project’s directory and run the following command. This will create a new virtual environment in a local folder named .venv:
python3 -m venv .venv
Activate a virtual environment
source .venv/bin/activate
To confirm the virtual environment is activated, check the location of your Python interpreter: