To create new virtual environment run

python -m venv {name}

note: venv is created based on python version of terminal so if you want to create python 3.10 based virtual env, select anaconda environment python 3.10 and then run command python -m venv {name}

press cmd + shift + p -> to select interpreter for python virtual env in vs-code

To install dependencies

install a particular package

pip install numpy

install all dependencies from requirements.txt

pip install -r requirements.txt

save dependencies listing in requirements.txt file

pip freeze > requirements.txt

install a particular version of package

pip install pandas==1.1.3

below command is used to install all missing stubs of the required libraries in a file

mypy main.py --install-types