问题
I have been trying to distrubute my simple Kivy app on Mac OS and I have been still failing. My environment: macOS Mojave ver. 10.14.6 Python 3.7.3 installed with Homebrew along with pyenv that enables to maintain a couple of python versions Kivy 1.11.1 installed along with bunch of Homebrew libs such as pig-config sdl2 sdl2_image, Gstreamer etc.
The application works pretty fine when it is run from the local environment, however I am not able to create a version for distribution.
I spent some time with pyinstaller but it was constantly giving me errors of missing paths and libraries so I started to look for another tool and I found out py2app.
I can easily run the application in alias mode using:
python setup.py py2app -A
and then
./dist/app.app/Contents/MacOS/app
but when I am using a normal mode to create a deployment version:
python setup.py py2app
and then launch the application
./dist/app.app/Contents/MacOS/app
I am getting the error below:
[INFO ] [Kivy ] v1.11.1
[INFO ] [Kivy ] Installed at "/Users/ttt/app2/dist/app.app/Contents/Resources/lib/python37.zip/kivy/__init__.pyc"
[INFO ] [Python ] v3.7.3 (default, Nov 4 2020, 11:39:31)
[Clang 10.0.1 (clang-1001.0.46.4)]
[INFO ] [Python ] Interpreter at "/Users/ttt/app2/dist/app.app/Contents/MacOS/python"
Traceback (most recent call last):
File "/Users/ttt/app2/dist/app.app/Contents/Resources/__boot__.py", line 101, in <module>
_run()
File "/Users/ttt/app2/dist/app.app/Contents/Resources/__boot__.py", line 84, in _run
exec(compile(source, path, "exec"), globals(), globals())
File "/Users/ttt/app2/dist/app.app/Contents/Resources/app.py", line 4, in <module>
from kivy.app import App
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "kivy/app.pyc", line 319, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "kivy/base.pyc", line 26, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
File "kivy/clock.pyc", line 363, in <module>
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
SystemError: <method 'load_module' of 'zipimport.zipimporter' objects> returned NULL without setting an error
2020-11-12 14:38:41.362 app[68264:333518] app Error```
I did a google search on
**SystemError: <method 'load_module' of 'zipimport.zipimporter' objects> returned NULL without setting an error**
but I didn't get any responses related to this issue.
I am not sure what I should do to troubleshoot.
Any insights would be appreciated.
来源:https://stackoverflow.com/questions/64807762/kivy-application-deployment-using-py2app-on-mac-os-mojave