For Python program using a virtual environment, you can directly pip freeze. But there is no use for the virtual environment, and then use pip freeze to die, because it will all system packages are exported.
Therefore, the use of third-party libraries pipreqs
installation
pip3 install pipreqs
Generate requirements.txt file
` pipreqs ./
If the file exists --force can be used to cover the default will not be covered.
pipreqs --force ./