If your ultimate goal is to generate version constraints on Python package dependencies in debian/control, note that Debian packages of Python modules usually try to avoid that: they only specify version ranges, if anything. See for example two of the Python packages I maintain: python3-pyqt5.qtchart and python3-pyqt6.qtcharts.
To pin versions, as far as I’m aware the generally accepted way is as follows. Assuming all the required packages are installed on your Debian system, asking pip to freeze the requirements again will update them to match the installed packages:
pip freeze --requirement requirements.txt | sed '/^\s*#.*pip freeze/,$ d' > new-requirements.txt
You can then check new-requirements.txt and replace requirements.txt with it if everything’s OK.
The sed filter is used to remove potentially transitive dependencies added by pip.