I show how to generate a requirements.txt (essential to Python projects), and how to generate a single exe file from a Python project using "pyinstaller."
TL;DR - I show how to generate a requirements.txt (essential to Python projects), and how to generate a single exe file from a Python project using "pyinstaller."
fuzzyListDedupeGUI
The below GUI is from a project I used Tkinter and ChatGPT on check it out 😁.
https://blog.cybersader.com/fuzzy-deduplicate-bullet-points-from-chatgpt/

How to Generate an EXE from the Python Code
Using PyInstaller — PyInstaller 5.8.0 documentation
- Navigate to your project directory in the terminal using the
cdcommand - navigate to wherever your Python code and virtual environment are. - Use the
pipreqslibrary to generate yourrequirements.txtfile.
This is essential when creating Python projects so that other people can replicate the attached libraries and dependencies. In the case of my program, the only dependency is the "fuzzywuzzy" library which will show up asfuzzywuzzy==0.18.0in the requirements.txt file
To use piqreqs use the following commands while in the same directory as your Python file:pip install pipreqspipreqs . --force
This will scan the Python files in the current directory and generate a requirements.txt file that includes all the necessary dependencies.
The--forceoption will overwrite the existing requirements.txt file if one already exists.
Note: The dot.indicates the current directory. You can also specify a path to a specific directory if your Python files are located elsewhere.
- Use PyInstaller to create the EXE file. Run the following commands in your CLI:
pip install pyinstaller
— THEN RUN —pyinstaller --noconsole --onefile --paths=[path to the folder with your dependencies in it] main.py
If you're using a virtual environment then the path to the "lib" (libraries/dependency code) folder will be used in the command similar to this:pyinstall --noconsole --onefile --path=./venv/Libs/site-packages main.py. This is how I did it with the code generated using Pycharm as my IDE/editor.
I use the--noconsoleflag because I didn't want a console to pop up when I run the exe by double-clicking it.
Note on Virtual Environment Issues in Pycharm
If I ever get the "activate.ps1" error, I just do the following in Pycharm:
