我创建了一个带有py2app的osx应用程序,用Kivy用Python编写,但是当我打开应用程序时发现消息“Appkivy Error”。我已在终端中打开,发现“ImportError:没有名为weakmethod的模块”。请问有人告诉我如何解决这个问题?
Python版本:2.7.14。
Kivy版本1.10.0。
Osx:Sierra 10.12.6
Python代码:
from kivy.app import App
from kivy.uix.button import Button
class TestApp(App):
def build(self):
return Button(text='Hello World')
TestApp().run()
设置文件代码:
from setuptools import setup
APP = ['Appkivy.py']
DATA_FILES = []
OPTIONS = {'argv_emulation': True}
setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
错误登录终端:
[INFO ] [Logger ] Record log in /Users/crisflores/.kivy/logs/kivy_17-12-05_7.txt
[INFO ] [Kivy ] v1.10.0
[INFO ] [Python ] v2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 12:01:12)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
Traceback (most recent call last):
File "/Users/crisflores/Desktop/dist/Appkivy.app/Contents/Resources/__boot__.py", line 386, in <module>
_run()
File "/Users/crisflores/Desktop/dist/Appkivy.app/Contents/Resources/__boot__.py", line 370, in _run
exec(compile(source, path, 'exec'), globals(), globals())
File "/Users/crisflores/Desktop/dist/Appkivy.app/Contents/Resources/Appkivy.py", line 1, in <module>
from kivy.app import App
File "kivy/app.pyc", line 319, in <module>
File "kivy/base.pyc", line 29, in <module>
File "kivy/clock.pyc", line 362, in <module>
File "kivy/_clock.pyc", line 14, in <module>
File "kivy/_clock.pyc", line 10, in __load
File "kivy/_clock.pyx", line 9, in init kivy._clock
ImportError: No module named weakmethod
2017-12-05 20:45:02.688 Appkivy[11703:496925] Appkivy Error
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
我已经重新加载了Kivy和py2app但它不起作用。提前谢谢!