简体   繁体   English

pyinstaller EXE文件无能为力

[英]Pyinstaller EXE file does nothing

I use pyinstaller to create onefile exe . 我使用pyinstaller创建pyinstaller exe It works on few computers but one. 它只能在少数几台计算机上工作。 I can't work out why. 我不知道为什么。 There is no error when I run this from command window. 从命令窗口运行此文件时没有错误。 I can see a window for point of a second and it dissapear. 我可以看到一秒钟的窗口,它消失了。 Below is my spec file. 以下是我的spec文件。 There is no antivirus installed. 没有安装防病毒软件。 Also windows firewall is shut down. Windows防火墙也被关闭。

SPEC 规格

from kivy.deps import sdl2, glew
block_cipher = None
a = Analysis(['main.py'],
             pathex=['C:\\Users\\Patryk\\GUI\\EXE'],
             binaries=None,
             datas=None,
             hiddenimports=[],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)

exe = EXE(pyz,Tree('C:\\Users\\PycharmProjects\\GUI\\EXE'),
          a.scripts,
          a.binaries,
          a.zipfiles,
          a.datas,
          *[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)],
          name='Bajot2',
          debug=False,
          strip=False,
          upx=True,
          console=False, 
          runtime_tmpdir=None,
          icon='main_logo.ico' )

I've managed to see the error. 我设法看到了错误。 That's makes me closer to solve it. 那使我更接近解决它。

ERROR 错误

[INFO   ] [Logger      ] Record log in C:\Users\Dell\.kivy\logs\kivy_19-07-02_7.
txt
[INFO   ] [Kivy        ] v1.10.1
[INFO   ] [Python      ] v3.6.2 (v3.6.2:5fd33b5, Jul  8 2017, 04:57:36) [MSC v.1
900 64 bit (AMD64)]
[INFO   ] [Factory     ] 194 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil
, img_ffpyplayer ignored)
[INFO   ] [Text        ] Provider: sdl2
[INFO   ] [Window      ] Provider: sdl2
[INFO   ] [GL          ] Using the "OpenGL" graphics system
[INFO   ] [GL          ] GLEW initialization succeeded
[INFO   ] [GL          ] Backend used <glew>
[INFO   ] [GL          ] OpenGL version <b'4.2.0 - Build 10.18.10.3262'>
[INFO   ] [GL          ] OpenGL vendor <b'Intel'>
[INFO   ] [GL          ] OpenGL renderer <b'Intel(R) HD Graphics 4600'>
[INFO   ] [GL          ] OpenGL parsed version: 4, 2
[INFO   ] [GL          ] Shading version <b'4.20 - Build 10.18.10.3262'>
[INFO   ] [GL          ] Texture max size <16384>
[INFO   ] [GL          ] Texture max units <16>
[WARNING] [Image       ] Unable to load image <C:\Users\Dell\AppData\Local\Temp\
_MEI40162\kivy_install\data\glsl\default.png>
[CRITICAL] [Window      ] Unable to find any valuable Window provider.
sdl2 - Exception: SDL2: Unable to load image
  File "site-packages\kivy\core\__init__.py", line 67, in core_select_lib
  File "site-packages\kivy\core\window\window_sdl2.py", line 140, in __init__
  File "site-packages\kivy\core\window\__init__.py", line 968, in __init__
  File "site-packages\kivy\core\window\window_sdl2.py", line 294, in create_wind
ow
  File "site-packages\kivy\core\window\__init__.py", line 1216, in create_window


  File "kivy\graphics\instructions.pyx", line 759, in kivy.graphics.instructions
.RenderContext.__init__
  File "site-packages\kivy\core\image\__init__.py", line 536, in __init__
  File "site-packages\kivy\core\image\__init__.py", line 732, in _set_filename
  File "site-packages\kivy\core\image\__init__.py", line 435, in load
  File "site-packages\kivy\core\image\__init__.py", line 201, in __init__
  File "site-packages\kivy\core\image\img_sdl2.py", line 41, in load
[CRITICAL] [App         ] Unable to get a Window, abort

.

It is probably due to different version and packages installed. 可能是由于安装了不同的版本和软件包。 Try creating and environment with Python 3.6, install Pyinstaller in it and it should work. 尝试使用Python 3.6创建和环境,在其中安装Pyinstaller,它应该可以工作。

Launch the executable from the command line, open a cmd window and navigate to your exe, then just type the name of the exe. 从命令行启动可执行文件,打开一个cmd窗口并导航到您的exe,然后只需键入该exe的名称即可。

What's happening is that it's throwing an error and immediately shutting down before you can read it, If you launch from the command line the command window will stay open and you'll be able to read the error 发生的情况是它抛出错误并立即关闭,然后您才能读取它。如果从命令行启动,则命令窗口将保持打开状态,并且您将能够读取错误

I always highly recommend to use a windows batch file for configuring and using pyinstaller . 我始终强烈建议使用Windows批处理文件来配置和使用pyinstaller This is basically a text file with the extension ".bat" or ".cmd". 这基本上是一个扩展名为“ .bat”或“ .cmd”的文本文件。 You can simply edit it and call it via double-click. 您可以简单地对其进行编辑并通过双击来调用它。

WINDOWS BATCH-FILE Windows批处理文件

@echo off

:: Do what you like...

pyinstaller --clean ^
--one-file ^
--name BLABLA_PROG ^
main.spec

PAUSE

COMMENT 评论

The last command is now important for debugging, because the command window will remain open. 现在,最后一条命令对于调试很重要,因为命令窗口将保持打开状态。

重新安装intel图形卡驱动程序后, .exe不会出现任何问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM