pip assists in creating requirements.txt files by providing the [freeze](<https://pip.pypa.io/en/stable/reference/pip_freeze/>) option.

pip freeze > requirements.txt

This will save a list of all packages and their version installed on the system to a file named requirements.txt in the current folder.