I have a python program that I am converting to a .exe file. I have compiled with Pyinstaller and all is working fine. I now want to get rid of the console window as I have a pyqt user interface. I have tried:
pyinstaller --onefile --windowed --icon=favicon.ico main.py
Its compiling fine and running however when chromedriver is activated it doesnt show up. It works fine when i do not use --windowed or --noconsole.
Anyone had this problem before?
Thanks Jamie
add --noconsole
flag to your script call and remove --windowed
, I tested this and it worked for me.
this would be :
pyinstaller --noconsole --icon=favicon.ico main.py
In Python 2.7 use subprocess like this:
DEVNULL = open(os.devnull,"wb")
output = subprocess.check_output(command, shell=True,stderr=DEVNULL,stdin=DEVNULL)
In Python 3 use subprocess like this:
DEVNULL = subprocess.DEVNULL
output=subprocess.check_output(command,shell=True, stderr = DEVNULL , stdin = DEVNULL )
Hopefully it will solve your problem.
Change the extension of your main (GUI) file. From: *.py to *.pyw
(Python officially supported).
Then: pyinstaller --onefile --noconsole main.pyw
This worked for me.
I know that this question has been since 2016, but I would like to share my knowledge.
Try to put --noconsole
before --onefile
.
So, the command will be:
pyinstaller --noconsole --onefile --windowed --icon=favicon.ico main.py
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.