[英]Pyinstaller --windowed or --noconsole .exe not allowing chromedriver to open
I have a python program that I am converting to a .exe file. 我有一个要转换为.exe文件的python程序。 I have compiled with Pyinstaller and all is working fine.
我已经使用Pyinstaller进行了编译,并且一切正常。 I now want to get rid of the console window as I have a pyqt user interface.
我现在想摆脱控制台窗口,因为我有一个pyqt用户界面。 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. 它的编译正常并且正在运行,但是当chromedriver激活时,它不会显示。 It works fine when i do not use --windowed or --noconsole.
当我不使用--windowed或--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. 在您的脚本调用中添加
--noconsole
标志,并删除--windowed
,我对此进行了测试,它对我--windowed
。
this would be : 这将是:
pyinstaller --noconsole --icon=favicon.ico main.py
In Python 2.7 use subprocess like this: 在Python 2.7中,使用如下子过程:
DEVNULL = open(os.devnull,"wb")
output = subprocess.check_output(command, shell=True,stderr=DEVNULL,stdin=DEVNULL)
In Python 3 use subprocess like this: 在Python 3中,使用如下子过程:
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. 更改主(GUI)文件的扩展名。 From:
*.py to *.pyw
(Python officially supported). 从:
*.py to *.pyw
(Python正式支持)。
Then: pyinstaller --onefile --noconsole main.pyw
然后:
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. 我知道这个问题是自2016年以来的,但我想分享我的知识。
Try to put --noconsole
before --onefile
. 尝试把
--noconsole
之前--onefile
。
So, the command will be: 因此,命令将是:
pyinstaller --noconsole --onefile --windowed --icon=favicon.ico main.py
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.