3

I am trying to compile my python script built in python 3 using pyqt5 module on windows 10 using pyinstaller which hides the windows while running.

To compile my script I executed following command:

pyinstaller --onefile --icon=app.ico --clean --noconsole app.py

But the executable I got didn't worked so again I compiled my script by following command:

 pyinstaller --onefile -w --icon=app.ico  app.py

Still the output executable is not working if --console/-w/--windowed argument is used.

How can I make my executable run without console?

this is the script i try to execute it

import threading
import subprocess
import sys
import time

f = open("build\\eco.txt", "x")
f = open("build\\sou.txt", "x")

def run_process(path):
    cmd = 'python %s' % path
    process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
    for line in iter(process.stdout.readline, ''):
        sys.stdout.write(line)


t1 = threading.Thread(target=run_process, args=('py1.py',))
t2 = threading.Thread(target=run_process, args=('py2.py',))
t3 = threading.Thread(target=run_process, args=('py3.py',))
t4 = threading.Thread(target=run_process, args=('py4.py',))
t5 = threading.Thread(target=run_process, args=('py5.py',))


#start
t1.start()
t2.start()
t3.start()
t4.start()
t5.start()

# Waiting
t1.join()
t2.join()
t3.join()
t4.join()
t5.join()

Thanks

2

1 Answer 1

4

pass -w or --windowed or --noconsole flag to hide console.

Try GUI pyinstaller by installing auto py to exe. It makes you more easier to compile your script.

pip install auto-py-to-exe
Sign up to request clarification or add additional context in comments.

3 Comments

i tried it as well but not working, it is using pyinstaller by the way
-w or --windowed or --noconsole works perfectly for me to hide console. Maybe reinstalling pyinstaller might solve your problem
yes, it works with pyqt5. And you have to include files like pictures, etc in one directory (in case you have not )

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.