Use below command to install pytest.
pip install pytest
To install any specific version of pytest then use the “==” symbol along with the version number.
pip install pytest == 6.2.1
If we don’t specify the version then it will try to install the latest version which is available.
If we need to check the pytest version then use below command.
pytest --version