問題描述
我無法使用 pyinstaller 生成工作 exe(應用程序的名稱是 settings_gui).
I'm unable to produce a working exe with pyinstaller (the name of the app is settings_gui).
運行時錯誤:(完整日志)
[WARNING ] [Image ] Unable to load image <<project_path>distSETTIN~1kivy_installdataglsldefault.png>
[CRITICAL ] [Window ] Unable to find any valuable Window provider
at all!
sdl2 - Exception: SDL2: Unable to load image
File "site-packageskivycore\__init__.py", line 67, in core_select_lib
File "site-packageskivycorewindowwindow_sdl2.py", line 138, in __init__
File "site-packageskivycorewindow\__init__.py", line 722, in __init__
File "site-packageskivycorewindowwindow_sdl2.py", line 255, in create_wind
ow
File "site-packageskivycorewindow\__init__.py", line 897, in create_window
File "kivygraphicsinstructions.pyx", line 756, in kivy.graphics.instructions
.RenderContext.__init__ (kivygraphicsinstructions.c:10729)
File "site-packageskivycoreimage\__init__.py", line 512, in __init__
File "site-packageskivycoreimage\__init__.py", line 700, in _set_filename
File "site-packageskivycoreimage\__init__.py", line 430, in load
File "site-packageskivycoreimage\__init__.py", line 198, in __init__
File "site-packageskivycoreimageimg_sdl2.py", line 42, in load
[CRITICAL ] [App ] Unable to get a Window, abort.
Exception SystemExit: 1 in 'kivy.properties.dpi2px' ignored
[INFO ] [Text ] Provider: sdl2
Traceback (most recent call last):
File "settings_gui.py", line 26, in <module>
AttributeError: 'NoneType' object has no attribute 'clearcolor'
Failed to execute script settings_gui
出了什么問題?我檢查了 <project_path>/dist/settings_gui/kivy_install/data/glsl/default.png
,它就在那里.我覺得很奇怪,但是路徑是 SETTING~1
,這正常嗎?我看過 this thread 建議通過 _MEIPASS<重定向資源/code>,但這無濟于事 - 意料之中,因為我不是在單文件模式下構建我的應用程序.
What is going wrong? I checked <project_path>/dist/settings_gui/kivy_install/data/glsl/default.png
, it's there. I find it weird however that the path is SETTING~1
, is that normal? I've seen this thread which recommends to redirect the resources through _MEIPASS
, but this doesn't help - expectedly, since I'm not building my app in one-file-mode.
感謝任何有關如何解決此問題的提示.
Any tip on how to troubleshoot this is appreciated.
編輯:
更多信息:
- 沒有 pyinstaller,應用程序運行得非常好——除非我關閉它或以其他方式停止它;當我這樣做時,python 崩潰了.
- 當我構建我的應用程序時,會打開一個 kivy 窗口并立即崩潰.我總是關閉它并繼續構建過程.
- 我的 .spec 文件
- 構建日志
推薦答案
我通過復制文件解決了這個問題
I managed to fix the issue by copying file
From: [Python]sharesdl2inlibpng16-16.dll
To: [Dist]<projectName>libpng16-16.dll
那里已經有一個文件實例,但我替換它的那個實例大了大約 20kb(從 198kb 到 213kb).
There was an instance of the file already there but the one I replaced it with was about 20kb larger (from 198kb to 213kb).
重要的是我的應用程序現在可以運行,我沒有更改任何其他內容.
The important part is that my app works now and I didn't change anything else.
這篇關于SDL2 錯誤:“無法加載圖像 <default.png>"使用 pyinstaller 凍結 kivy 應用程序時的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!