Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyInstaller .exe does nothing

I am trying to compile a complex script into an exe with PyInstaller, this is the install command I am currently using although I have tried many variations of these flags: pyinstaller -w -F --debug=all --noupx --name godnesssakes .\uhoh.py

When I run the exe from the command line I get no output whatsoever, even with debug mode enabled: enter image description here

Even after simplifying my python script to a simple print command I am still getting no output:

def main():
    print('test')

main()

I have tried everything including reinstalling python, reinstalling pip, verifying path, verifying no conflicting versions, using --path flag in pyinstaller...

Versions:

  • Python 3.9.9
  • Pyinstaller 5.4.1

Answers that have NOT helped:

  • Pyinstaller, .exe file does nothing
  • Pyinstaller EXE file does nothing
  • Pyinstaller generating EXE that does nothing
  • PyInstaller .exe file does nothing
like image 269
zbarnz Avatar asked May 06 '26 16:05

zbarnz


1 Answers

Follow each of these steps... or use your operating system's equvalent.

  1. mkdir newdir and cd newdir
  2. py -m venv venv and venv\Scripts\activate
  3. py -m pip install --upgrade pip pyinstaller
  4. copy your script into the newdir/main.py

To make it even more obvious:....

def main():
    while True:
        print('test', end='\r')

main()
  1. pyinstaller -F --debug=all --noupx --name goodnesssakes main.py
  2. dist\goodnesssakes.exe

The actual problem is that you are using the -w flag which tells pyinstaller that it is a windowed application and therefore doesn't output anything to the console. It is literally and alias for --noconsole

like image 90
Alexander Avatar answered May 08 '26 06:05

Alexander



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!