You can use pipreqs to automatically generate a requirements.txt file based on the import statements that the Python script(s) contain. To use pipreqs, assuming that you are in the directory where example.py is located: pip install pipreqs pipreqs . It will generate the following requirements.txt file: requests==2.23.0 beautifulsoup4==4.9.1 which you can install with: pip install -r requirements.txt
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter