[英]pyinstaller2.0 --noconsole won't run my exe when I click on it
I have pyinstaller2.0** installed and am using Python 2.7.5 32bit on a Windows7-64bit OS. 我已安装pyinstaller2.0 **,并在Windows7-64位操作系统上使用32位Python 2.7.5。
I'm trying to create an application with no console. 我正在尝试创建没有控制台的应用程序。 When I use --noconsole
and click on my generated .exe
it doesn't open. 当我使用--noconsole
并单击生成的.exe
它不会打开。
If I change the console to true by using the --console
my application runs just fine but I have a console. 如果我通过使用--console
将控制台更改为true,则我的应用程序可以正常运行,但是我有一个控制台。
I've been searching solid for a few hours here and google and looking at other tutorials and I am not able to find any other threads of this issue. 我已经在这里和Google上搜索了几个小时,并且正在寻找其他教程,但找不到该问题的任何其他主题。
This is what I have in my batch file for compiling my EXE 这是我的批处理文件中用于编译EXE的文件
c:\python27_32\python.exe pyinstaller.py --onefile --noconsole c:\python27_32\tutorial5.py
Here is my warning file; 这是我的警告文件;
W: no module named posix (conditional import by os)
W: no module named readline (delayed, conditional import by cmd)
W: no module named readline (delayed import by pdb)
W: no module named pwd (delayed, conditional import by posixpath)
W: no module named org (top-level import by pickle)
W: no module named posix (delayed, conditional import by __main__)
W: no module named posix (delayed, conditional import by iu)
W: no module named Crypt (delayed, conditional import by __main__)
W: no module named fcntl (conditional import by subprocess)
W: no module named AES (delayed, conditional import by __main__)
W: no module named org (top-level import by copy)
W: no module named _emx_link (conditional import by os)
W: no module named fcntl (top-level import by tempfile)
W: no module named AES (delayed, conditional import by archive)
W: __all__ is built strangely at line 0 - collections (c:\python27_32\lib\collections.pyc)
W: delayed exec statement detected at line 0 - collections (c:\python27_32\lib\collections.pyc)
W: delayed conditional __import__ hack detected at line 0 - unittest.main (c:\python27_32\lib\unittest\main.pyc)
W: __all__ is built strangely at line 0 - dis (c:\python27_32\lib\dis.pyc)
W: delayed __import__ hack detected at line 0 - encodings (c:\python27_32\lib\encodings\__init__.pyc)
W: delayed __import__ hack detected at line 0 - optparse (c:\python27_32\lib\optparse.pyc)
W: delayed __import__ hack detected at line 0 - ctypes (c:\python27_32\lib\ctypes\__init__.pyc)
W: delayed __import__ hack detected at line 0 - ctypes (c:\python27_32\lib\ctypes\__init__.pyc)
W: delayed conditional __import__ hack detected at line 0 - unittest.loader (c:\python27_32\lib\unittest\loader.pyc)
W: delayed conditional __import__ hack detected at line 0 - unittest.loader (c:\python27_32\lib\unittest\loader.pyc)
W: delayed __import__ hack detected at line 0 - unittest.loader (c:\python27_32\lib\unittest\loader.pyc)
W: delayed conditional __import__ hack detected at line 0 - doctest (c:\python27_32\lib\doctest.pyc)
W: delayed exec statement detected at line 0 - doctest (c:\python27_32\lib\doctest.pyc)
W: delayed conditional __import__ hack detected at line 0 - doctest (c:\python27_32\lib\doctest.pyc)
W: delayed exec statement detected at line 0 - pdb (c:\python27_32\lib\pdb.pyc)
W: delayed conditional eval hack detected at line 0 - pdb (c:\python27_32\lib\pdb.pyc)
W: delayed eval hack detected at line 0 - pdb (c:\python27_32\lib\pdb.pyc)
W: delayed conditional eval hack detected at line 0 - pdb (c:\python27_32\lib\pdb.pyc)
W: delayed eval hack detected at line 0 - pdb (c:\python27_32\lib\pdb.pyc)
W: __all__ is built strangely at line 0 - __future__ (c:\python27_32\lib\__future__.pyc)
W: __all__ is built strangely at line 0 - hashlib (c:\python27_32\lib\hashlib.pyc)
W: __all__ is built strangely at line 0 - tokenize (c:\python27_32\lib\tokenize.pyc)
W: __all__ is built strangely at line 0 - tokenize (c:\python27_32\lib\tokenize.pyc)
W: __all__ is built strangely at line 0 - wx (c:\python27_32\lib\site-packages\wx-2.8-msw-unicode\wx\__init__.pyc)
W: __all__ is built strangely at line 0 - wx (c:\python27_32\lib\site-packages\wx-2.8-msw-unicode\wx\__init__.pyc)
W: delayed exec statement detected at line 0 - bdb (c:\python27_32\lib\bdb.pyc)
W: delayed eval hack detected at line 0 - bdb (c:\python27_32\lib\bdb.pyc)
W: delayed eval hack detected at line 0 - bdb (c:\python27_32\lib\bdb.pyc)
W: delayed __import__ hack detected at line 0 - pickle (c:\python27_32\lib\pickle.pyc)
W: delayed __import__ hack detected at line 0 - pickle (c:\python27_32\lib\pickle.pyc)
W: delayed conditional exec statement detected at line 0 - iu (C:\pyinstaller\PyInstaller\loader\iu.pyc)
W: delayed conditional exec statement detected at line 0 - iu (C:\pyinstaller\PyInstaller\loader\iu.pyc)
W: delayed eval hack detected at line 0 - gettext (c:\python27_32\lib\gettext.pyc)
W: delayed conditional eval hack detected at line 0 - warnings (c:\python27_32\lib\warnings.pyc)
W: delayed conditional __import__ hack detected at line 0 - warnings (c:\python27_32\lib\warnings.pyc)
and here is my spec file output; 这是我的规格文件输出;
# -*- mode: python -*-
a = Analysis(['c:\\python27_32\\tutorial5.py'],
pathex=['C:\\pyinstaller'],
hiddenimports=[],
hookspath=None)
pyz = PYZ(a.pure)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name=os.path.join('dist', 'tutorial5.exe'),
debug=False,
strip=None,
upx=True,
console=True )
app = BUNDLE(exe,
name=os.path.join('dist', 'tutorial5.exe.app'))
Everything is fine if I have the console, but nothing happens if I want no console.. 如果我有控制台,一切都很好,但是如果我不想要控制台,则什么也不会发生。
Is there something obvious that I am missing? 有什么明显的我想念的东西吗?
I appreciate the assistance. 感谢您的协助。
Vinster 温斯特
If you never open any GUI windows or anything like that, relying on the console for user I/O, and also suppress the console appearing, the program will launch silently (that is, without opening any windows), which may give the appearance of it not running. 如果您从不打开任何GUI窗口或类似的窗口,而是依靠控制台进行用户I / O, 并且也抑制了控制台的出现,则该程序将以静默方式启动(即,不打开任何窗口),这可能会显示它没有运行。
To check this, you have several options. 要检查这一点,您有几种选择。
sleep(30)
or something). 制作一个仅停留一段时间的玩具应用程序( sleep(30)
东西)。 Compile. 编译。 Run. 跑。 Open Task Manager and look for it. 打开任务管理器并寻找它。 If it's there, my hypothesis is correct. 如果存在,我的假设是正确的。 Basically, if you want to not bother with a console, you need 基本上,如果您不想打扰控制台,则需要
You can't just get rid of the console and expect a program to run unchanged. 您不能仅仅摆脱控制台,而期望程序不会改变。 It will run, but without being able to request input or display results. 它会运行,但无法请求输入或显示结果。 There's no magic that makes a GUI appear for you. 没有任何魔术可以使GUI出现。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.