Search code examples
pythonpython-3.xpackaging

Problem with making a .exe without a console window (PyInstaller)


I've made a executable of a python code, but everytime I run it, a console window opens. To stop that, I've tried:

  • Running --noconsole while packaging
  • changing the the console=True to console=False on the .spec file.

The first one doesn't work at all, nothing changes. When I do the second one, though, the .exe stops working (when I try to open, it doesn't).

Any suggestions ?


Solution

  • I believe you are using pyinstaller to create an exe.

    Just add --noconsole flag and the command window wont appear.

    e.g.

    pyinstaller --noconsole scriptname.py

    As pointed out by author this works after changing to debug=True and console=False in spec file.