通过Pyinstaller生成的Python-to-EXE未针对基于kivy的Python运行

2024-10-02 00:28:32 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个基于kivy的python Hello World程序。如果我从vs代码启动应用程序,它将正常工作。我已经使用pyinstaller从这个生成了一个独立的exe。exe已成功生成,但未运行。只是一个闪屏来来去去去

以下是程序代码

from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.anchorlayout import AnchorLayout
from kivy.uix.button import Button
from kivy.uix.label import Label


class Grid_Layout_Demo(GridLayout):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.rows = 2
        self.column = 2
        self.l1 = Label(
            text = 'Pls click the button'
        )
        self.add_widget(self.l1)

        self.b1 = Button(
            text = 'Click Me',
            background_color = (0,24,67,1),
            color = (0,0,0,1)
        )
        self.add_widget(self.b1)


class Intro(App):

    def build(self):
        return Grid_Layout_Demo()

Intro().run()

下面是生成exe时的日志消息:

PS C:\Users\sj3kc0\Desktop\kivy> pyinstaller --onefile -w gridLayout.py
247 INFO: PyInstaller: 4.5.1
247 INFO: Python: 3.9.6
379 INFO: Platform: Windows-10-10.0.17763-SP0
381 INFO: wrote C:\Users\sj3kc0\Desktop\kivy\gridLayout.spec
393 INFO: UPX is not available.
406 INFO: Extending PYTHONPATH with paths
['C:\\Users\\sj3kc0\\Desktop\\kivy', 'C:\\Users\\sj3kc0\\Desktop\\kivy']
1075 INFO: checking Analysis
1075 INFO: Building Analysis because Analysis-00.toc is non existent
1076 INFO: Initializing module dependency graph...
1084 INFO: Caching module graph hooks...
1136 INFO: Analyzing base_library.zip ...
5609 INFO: Processing pre-find module path hook distutils from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-distutils.py'.
5611 INFO: distutils: retargeting to non-venv dir 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\Lib'
9868 INFO: Caching module dependency graph...
10211 INFO: running Analysis Analysis-00.toc
10221 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by c:\python39\python.exe
10319 WARNING: lib not found: api-ms-win-core-path-l1-1-0.dll dependency of c:\python39\python39.dll
10726 INFO: Analyzing C:\Users\sj3kc0\Desktop\kivy\gridLayout.py
14501 INFO: Processing pre-find module path hook site from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path\\hook-site.py'.
14502 INFO: site: retargeting to fake-dir 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\fake-modules'
25505 INFO: Processing pre-safe import module hook six.moves from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks\\pre_safe_import_module\\hook-six.moves.py'.
28497 INFO: Processing module hooks...
28498 INFO: Loading module hook 'hook-certifi.py' from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
28513 INFO: Loading module hook 'hook-IPython.py' from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
29852 INFO: Loading module hook 'hook-jedi.py' from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
33474 INFO: Loading module hook 'hook-zmq.py' from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
33888 INFO: Loading module hook 'hook-difflib.py' from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks'...
33893 INFO: Loading module hook 'hook-distutils.py' from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks'...
33896 INFO: Loading module hook 'hook-distutils.util.py' from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks'...
33901 INFO: Loading module hook 'hook-encodings.py' from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks'...
34124 INFO: Loading module hook 'hook-heapq.py' from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks'...
34135 INFO: Loading module hook 'hook-kivy.py' from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks'...
[INFO   ] [Logger      ] Record log in C:\Users\sj3kc0\.kivy\logs\kivy_21-08-24_1.txt
34172 INFO: [Logger      ] Record log in C:\Users\sj3kc0\.kivy\logs\kivy_21-08-24_1.txt
[INFO   ] [deps        ] Successfully imported "kivy_deps.angle" 0.3.0
34171 INFO: [deps        ] Successfully imported "kivy_deps.angle" 0.3.0
[INFO   ] [deps        ] Successfully imported "kivy_deps.glew" 0.3.0
34192 INFO: [deps        ] Successfully imported "kivy_deps.glew" 0.3.0
[INFO   ] [deps        ] Successfully imported "kivy_deps.sdl2" 0.3.1
34209 INFO: [deps        ] Successfully imported "kivy_deps.sdl2" 0.3.1
[INFO   ] [Kivy        ] v2.0.0
34227 INFO: [Kivy        ] v2.0.0
[INFO   ] [Kivy        ] Installed at "C:\Users\sj3kc0\AppData\Local\Programs\Python\Python39\lib\site-packages\kivy\__init__.py"
34256 INFO: [Kivy        ] Installed at "C:\Users\sj3kc0\AppData\Local\Programs\Python\Python39\lib\site-packages\kivy\__init__.py"
[INFO   ] [Python      ] v3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64)]
34277 INFO: [Python      ] v3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64)]
[INFO   ] [Python      ] Interpreter at "c:\python39\python.exe"
34309 INFO: [Python      ] Interpreter at "c:\python39\python.exe"
[INFO   ] [Factory     ] 186 symbols loaded
34348 INFO: [Factory     ] 186 symbols loaded
[INFO   ] [Logger      ] Record log in C:\Users\sj3kc0\.kivy\logs\kivy_21-08-24_2.txt
[INFO   ] [deps        ] Successfully imported "kivy_deps.angle" 0.3.0
[INFO   ] [deps        ] Successfully imported "kivy_deps.glew" 0.3.0
[INFO   ] [deps        ] Successfully imported "kivy_deps.sdl2" 0.3.1
[INFO   ] [Kivy        ] v2.0.0
[INFO   ] [Kivy        ] Installed at "C:\Users\sj3kc0\AppData\Local\Programs\Python\Python39\lib\site-packages\kivy\__init__.py"
[INFO   ] [Python      ] v3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64)]
[INFO   ] [Python      ] Interpreter at "c:\python39\python.exe"
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil (img_ffpyplayer ignored)
[WARNING] [Could not find GStreamer plugins. Possible solution] set GST_PLUGIN_PATH
34936 WARNING: [Could not find GStreamer plugins. Possible solution] set GST_PLUGIN_PATH
[INFO   ] [Logger      ] Record log in C:\Users\sj3kc0\.kivy\logs\kivy_21-08-24_3.txt
[INFO   ] [deps        ] Successfully imported "kivy_deps.angle" 0.3.0
[INFO   ] [deps        ] Successfully imported "kivy_deps.glew" 0.3.0
[INFO   ] [deps        ] Successfully imported "kivy_deps.sdl2" 0.3.1
[INFO   ] [Kivy        ] v2.0.0
[INFO   ] [Kivy        ] Installed at "C:\Users\sj3kc0\AppData\Local\Programs\Python\Python39\lib\site-packages\kivy\__init__.py"
[INFO   ] [Python      ] v3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64)]
[INFO   ] [Python      ] Interpreter at "c:\python39\python.exe"
[INFO   ] [Audio       ] Providers: audio_sdl2 (audio_ffpyplayer ignored)
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil (img_ffpyplayer ignored)
[CRITICAL] [Camera      ] Unable to find any valuable Camera provider. Please enable debug logging (e.g. add -d if running from the command line, or change the log level in the config) and re-run your app to identify potential causes
picamera - ModuleNotFoundError: No module named 'picamera'
  File "C:\Users\sj3kc0\AppData\Local\Programs\Python\Python39\lib\site-packages\kivy\core\__init__.py", line 58, in core_select_lib
    mod = __import__(name='{2}.{0}.{1}'.format(
  File "C:\Users\sj3kc0\AppData\Local\Programs\Python\Python39\lib\site-packages\kivy\core\camera\camera_picamera.py", line 18, in <module>
    from picamera import PiCamera

gi - ModuleNotFoundError: No module named 'gi'
  File "C:\Users\sj3kc0\AppData\Local\Programs\Python\Python39\lib\site-packages\kivy\core\__init__.py", line 58, in core_select_lib
    mod = __import__(name='{2}.{0}.{1}'.format(
  File "C:\Users\sj3kc0\AppData\Local\Programs\Python\Python39\lib\site-packages\kivy\core\camera\camera_gi.py", line 10, in <module>
    from gi.repository import Gst

opencv - ModuleNotFoundError: No module named 'cv2'
  File "C:\Users\sj3kc0\AppData\Local\Programs\Python\Python39\lib\site-packages\kivy\core\__init__.py", line 58, in core_select_lib
    mod = __import__(name='{2}.{0}.{1}'.format(
  File "C:\Users\sj3kc0\AppData\Local\Programs\Python\Python39\lib\site-packages\kivy\core\camera\camera_opencv.py", line 48, in <module>
    import cv2

[INFO   ] [Clipboard   ] Provider: winctypes
[INFO   ] [Factory     ] 186 symbols loaded
[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.6.0 - Build 26.20.100.8142'>
[INFO   ] [GL          ] OpenGL vendor <b'Intel'>
[INFO   ] [GL          ] OpenGL renderer <b'Intel(R) HD Graphics 520'>
[INFO   ] [GL          ] OpenGL parsed version: 4, 6
[INFO   ] [GL          ] Shading version <b'4.60 - Build 26.20.100.8142'>
[INFO   ] [GL          ] Texture max size <16384>
[INFO   ] [GL          ] Texture max units <32>
[INFO   ] [Window      ] auto add sdl2 input provider
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[CRITICAL] [Spelling    ] Unable to find any valuable Spelling provider. Please enable debug logging (e.g. add -d if running from the command line, or change the log level in the config) and re-run your app to identify potential causes
enchant - ModuleNotFoundError: No module named 'enchant'
  File "C:\Users\sj3kc0\AppData\Local\Programs\Python\Python39\lib\site-packages\kivy\core\__init__.py", line 58, in core_select_lib
    mod = __import__(name='{2}.{0}.{1}'.format(
  File "C:\Users\sj3kc0\AppData\Local\Programs\Python\Python39\lib\site-packages\kivy\core\spelling\spelling_enchant.py", line 12, in <module>
    import enchant

[INFO   ] [Text        ] Provider: sdl2
[INFO   ] [Video       ] Provider: null(['video_ffmpeg', 'video_ffpyplayer'] ignored)
38912 INFO: Loading module hook 'hook-lib2to3.py' from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks'...
39036 INFO: Loading module hook 'hook-multiprocessing.util.py' from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks'...
39044 INFO: Loading module hook 'hook-pickle.py' from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks'...
39052 INFO: Loading module hook 'hook-PIL.Image.py' from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks'...
39756 INFO: Loading module hook 'hook-PIL.ImageFilter.py' from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks'...
39763 INFO: Loading module hook 'hook-PIL.py' from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks'...
39799 INFO: Loading module hook 'hook-PIL.SpiderImagePlugin.py' from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks'...
39806 INFO: Loading module hook 'hook-pkg_resources.py' from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks'...
40446 INFO: Processing pre-safe import module hook win32com from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\pre_safe_import_module\\hook-win32com.py'.
41053 WARNING: Hidden import "pkg_resources.py2_warn" not found!
41054 WARNING: Hidden import "pkg_resources.markers" not found!
41073 INFO: Loading module hook 'hook-pygments.py' from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks'...
43617 INFO: Loading module hook 'hook-sqlite3.py' from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks'...
43871 INFO: Loading module hook 'hook-sysconfig.py' from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks'...
43872 INFO: Loading module hook 'hook-wcwidth.py' from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks'...
43897 INFO: Loading module hook 'hook-win32ctypes.core.py' from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks'...
44320 INFO: Loading module hook 'hook-xml.dom.domreg.py' from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks'...
44322 INFO: Loading module hook 'hook-xml.etree.cElementTree.py' from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks'...
44328 INFO: Loading module hook 'hook-xml.py' from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks'...
44338 INFO: Loading module hook 'hook-_tkinter.py' from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks'...
44777 INFO: checking Tree
44778 INFO: Building Tree because Tree-00.toc is non existent
44781 INFO: Building Tree Tree-00.toc
45015 INFO: checking Tree
45015 INFO: Building Tree because Tree-01.toc is non existent
45018 INFO: Building Tree Tree-01.toc
45271 INFO: checking Tree
45271 INFO: Building Tree because Tree-02.toc is non existent
45275 INFO: Building Tree Tree-02.toc
45303 INFO: Loading module hook 'hook-docutils.py' from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
48393 INFO: Loading module hook 'hook-pythoncom.py' from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
49170 INFO: Loading module hook 'hook-pywintypes.py' from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
50002 INFO: Loading module hook 'hook-win32com.py' from 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\stdhooks'...
50865 INFO: Looking for ctypes DLLs
50968 INFO: Analyzing run-time hooks ...
50986 INFO: Including run-time hook 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_pkgutil.py'
50992 INFO: Including run-time hook 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_multiprocessing.py'
50998 INFO: Including run-time hook 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_inspect.py'
51002 INFO: Including run-time hook 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_kivy.py'
51012 INFO: Including run-time hook 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_gstreamer.py'
51015 INFO: Including run-time hook 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\rthooks\\pyi_rth_certifi.py'
51026 INFO: Including run-time hook 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\_pyinstaller_hooks_contrib\\hooks\\rthooks\\pyi_rth_traitlets.py'
51032 INFO: Including run-time hook 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_pkgres.py'
51050 INFO: Including run-time hook 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_win32api.py'
51053 INFO: Including run-time hook 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth_win32comgenpy.py'
51062 INFO: Including run-time hook 'C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\hooks\\rthooks\\pyi_rth__tkinter.py'
51108 INFO: Looking for dynamic libraries
51513 WARNING: lib not found: gstreamer-1.0-0.dll dependency of C:\Users\sj3kc0\AppData\Local\Programs\Python\Python39\lib\site-packages\kivy\lib\gstplayer\_gstplayer.cp39-win_amd64.pyd
51520 WARNING: lib not found: glib-2.0-0.dll dependency of C:\Users\sj3kc0\AppData\Local\Programs\Python\Python39\lib\site-packages\kivy\lib\gstplayer\_gstplayer.cp39-win_amd64.pyd
51525 WARNING: lib not found: gobject-2.0-0.dll dependency of C:\Users\sj3kc0\AppData\Local\Programs\Python\Python39\lib\site-packages\kivy\lib\gstplayer\_gstplayer.cp39-win_amd64.pyd
52469 INFO: Looking for eggs
52469 INFO: Using Python library c:\python39\python39.dll
52472 INFO: Found binding redirects:
[]
52510 INFO: Warnings written to C:\Users\sj3kc0\Desktop\kivy\build\gridLayout\warn-gridLayout.txt
52940 INFO: Graph cross-reference written to C:\Users\sj3kc0\Desktop\kivy\build\gridLayout\xref-gridLayout.html
53189 INFO: checking PYZ
53189 INFO: Building PYZ because PYZ-00.toc is non existent
53193 INFO: Building PYZ (ZlibArchive) C:\Users\sj3kc0\Desktop\kivy\build\gridLayout\PYZ-00.pyz
57407 INFO: Building PYZ (ZlibArchive) C:\Users\sj3kc0\Desktop\kivy\build\gridLayout\PYZ-00.pyz completed successfully.
57508 INFO: checking PKG
57509 INFO: Building PKG because PKG-00.toc is non existent
57518 INFO: Building PKG (CArchive) PKG-00.pkg
67825 INFO: Building PKG (CArchive) PKG-00.pkg completed successfully.
67978 INFO: Bootloader C:\Users\sj3kc0\AppData\Local\Programs\Python\Python39\lib\site-packages\PyInstaller\bootloader\Windows-64bit\runw.exe
67979 INFO: checking EXE
67991 INFO: Building EXE because EXE-00.toc is non existent
67995 INFO: Building EXE from EXE-00.toc
68022 INFO: Copying icons from ['C:\\Users\\sj3kc0\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\PyInstaller\\bootloader\\images\\icon-windowed.ico']
68026 INFO: Writing RT_GROUP_ICON 0 resource with 104 bytes
68026 INFO: Writing RT_ICON 1 resource with 3752 bytes
68028 INFO: Writing RT_ICON 2 resource with 2216 bytes
68028 INFO: Writing RT_ICON 3 resource with 1384 bytes
68034 INFO: Writing RT_ICON 4 resource with 38188 bytes
68042 INFO: Writing RT_ICON 5 resource with 9640 bytes
68046 INFO: Writing RT_ICON 6 resource with 4264 bytes
68059 INFO: Writing RT_ICON 7 resource with 1128 bytes
68079 INFO: Updating manifest in C:\Users\sj3kc0\Desktop\kivy\build\gridLayout\runw.exe.kmtx21ay
68081 INFO: Updating resource type 24 name 1 language 0
68107 INFO: Appending archive to EXE C:\Users\sj3kc0\Desktop\kivy\dist\gridLayout.exe
76751 INFO: Building EXE from EXE-00.toc completed successfully.
PS C:\Users\sj3kc0\Desktop\kivy>

下面是我生成的规范文件:

# -*- mode: python ; coding: utf-8 -*-


block_cipher = None


a = Analysis(['gridLayout.py'],
             pathex=['C:\\Users\\sj3kc0\\Desktop\\kivy'],
             binaries=[],
             datas=[],
             hiddenimports=[],
             hookspath=[],
             hooksconfig={},
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher,
             noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)

exe = EXE(pyz,
          a.scripts,
          a.binaries,
          a.zipfiles,
          a.datas,  
          [],
          name='gridLayout',
          debug=False,
          bootloader_ignore_signals=False,
          strip=False,
          upx=True,
          upx_exclude=[],
          runtime_tmpdir=None,
          console=False,
          disable_windowed_traceback=False,
          target_arch=None,
          codesign_identity=None,
          entitlements_file=None )

如何解决这个问题? 我是否遗漏了任何一步


Tags: pyinfolibpackageslocalsitehookusers
1条回答
网友
1楼 · 发布于 2024-10-02 00:28:32

试试这个:

from kivy_deps import sdl2, glew

# -*- mode: python ; coding: utf-8 -*-

block_cipher = None


a = Analysis(['gridLayout.py'],
             pathex=['C:\\Users\\sj3kc0\\Desktop\\kivy'],
             binaries=[],
             datas=[],
             hiddenimports=[],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher,
             noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)



exe = EXE(pyz,
          a.scripts,
          [],
          exclude_binaries=True,
          name='gridLayout',
          debug=True,
          bootloader_ignore_signals=False,
          strip=False,
          upx=True,
          console=True) 
coll = COLLECT(exe,
               a.binaries,
               a.zipfiles,
               a.datas,
               *[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)],
               strip=False,
               upx=True,
               upx_exclude=[],
               name='gridLayout')
# by setting the debug and console to True in the exe this will display the console 
# when you run your exe so you can see the log and the errors if any happened if 
# your exe work without any errors you can make them False to disable the console

然后您可以按如下方式运行它: pyinstaller pyinstaller.spec

相关问题 更多 >

    热门问题