I finished my python project and it's ready to hand into my teacher, however it's all one messy file. How do I make it so that all the files and images are compressed into one runnable .exe in which when they open this .exe, it runs the .py project?
Asked
Active
Viewed 96 times
-2
-
1Have you done any research? Duplicate of [Pyinstaller- Including assets in executable](https://stackoverflow.com/questions/36555088/pyinstaller-including-assets-in-executable) – esqew Aug 10 '21 at 12:36
-
Yes I have, I've been sitting here for the past 2 hours trying to research the solution.. I've done the --onefile -w audio.py method and all it does is open and close immediately.. – Toknn Aug 10 '21 at 12:40
-
1Then that's a new problem, and is most likely caused by an error in your program. Try to run your .exe from the command line and get the Traceback to see the *actual* errors. See the [When Things Go Wrong](https://pyinstaller.readthedocs.io/en/stable/when-things-go-wrong.html#when-things-go-wrong) docs of pyinstaller. Unfortunately, the picture of your app and your directory does not help in reproducing your problem. – Gino Mempin Aug 10 '21 at 13:05
2 Answers
2
You can give pyInstaller a try using the following flag
pyinstaller --onefile -w 'filename.py'

SecurityObscurity
- 439
- 2
- 11
1
Windows:
Inside the venv you are using:
pip install pyinstaller
pyinstaller my_script.py --noconsole --onefile
The --noconsole option will make sure that the only window shown in these cases is that of the graphical user interface of your program, since by default on Windows a system terminal will also be opened. It will remain active while the program is running, which could be confusing.

Carlo
- 444
- 4
- 12