A version number says which release you want. A hash says which exact file, and pip will refuse anything else.
Download a package and ask for its hash:
python3 -m pip download requests==X.Y.Z --no-deps -d ./pkgs
python3 -m pip hash ./pkgs/*.whl
Put the result in your requirements file, on the same logical line as the pinned version:
requests==X.Y.Z \
--hash=sha256:<paste the value here>
Then install in strict mode:
python3 -m pip install --require-hashes -r requirements.txt
If the file differs, pip stops with a message that the packages do not match the hashes, and shows the expected and received values. I like that failure: it is loud and nothing gets installed.
The strictness covers everything. Every dependency, direct or not, has to be pinned with == and carry a hash, or the install is refused. Writing that by hand gets old quickly, so a tool such as pip-tools, which can generate the hashes, is worth a look. Also list the hashes for each platform you deploy to, because the wheel for Linux and the one for macOS can be different files.
Further reading: pip secure installs, pip hash