Getting Rid of Console Output When Freezing Python Programs Using Pyinstaller

Getting rid of console output when freezing Python programs using Pyinstaller

If you want to hide the console window, here is the documentation:
This is how you use the --noconsole option

python pyinstaller.py --noconsole yourscript.py

If you need help using pyinstaller to get to the point where you need to use the --noconsole option here is a simple tutorial for getting there.

Hide the console of an .exe file created with PyInstaller

Did you try --windowed command line flag ?

Pyinstaller Codec Error on Executable When Using No Console And No Debug Option

I found out why it wasn't working, it's a bug in pyinstaller. It worked when I used the development version of pyinstaller. I ran pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip in cmd, and ran the pyinstaller command again, and it worked.

Is it possible to close cmd after opening exe file created from .py file?

You didn't specify the tools used to create the executable.

Assuming that you used PyInstaller:

When you execute the command pyinstaller [filename].py, PyInstaller will actually create 2 folders and one .spec file in your working directory:

  • A dist folder, containing the bundled app.
  • A build folder, containing some log files and working files.
  • A [scriptname].spec file, containing the specifications given to PyInstaller during the creation of the executable file.

In your case (assuming that PyInstaller was used), to stop the terminal from opening on startup, you have to:

  1. Open the .spec file
  2. Edit the entry console=True, setting it to false will prevent the terminal from opening.
  3. Execute again the pyinstaller command in cmd, this time targeting the [scriptname].spec file.


Related Topics



Leave a reply



Submit