我試圖給我的kivy遊戲添加一點物理,但很難讓「Kivent」和cymunk運行。 我認爲一切都已正確構建,但這些示例僅以python 2開頭,但不以python3開頭。Kivent無法啓動並運行python 3
,我得到了以下錯誤消息:
[email protected]:~/python/kivy-kivent-12766f1/examples/4_adding_physics_objects> python3 main.py
[INFO ] [Logger ] Record log in /home/mic/.kiv/logs/kivy_16-01-26_48.txt
[INFO ] [Kivy ] v1.9.1
[INFO ] [Python ] v3.4.1 (default, May 23 2014, 17:48:28) [GCC]
[INFO ] [Factory ] 179 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_gif, img_pygame (img_pil, img_ffpyplayer ignored)
[INFO ] [Window ] Provider: pygame(['window_egl_rpi'] ignored)
[INFO ] [GL ] OpenGL version <b'3.0 Mesa 10.3.7'>
[INFO ] [GL ] OpenGL vendor <b'Intel Open Source Technology Center'>
[INFO ] [GL ] OpenGL renderer <b'Mesa DRI Intel(R) Haswell Mobile '>
[INFO ] [GL ] OpenGL parsed version: 3, 0
[INFO ] [GL ] Shading version <b'1.30'>
[INFO ] [GL ] Texture max size <8192>
[INFO ] [GL ] Texture max units <32>
[INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
[INFO ] [OSC ] using <multiprocessing> for socket
Traceback (most recent call last):
File "main.py", line 8, in <module>
import kivent_cymunk
File "/home/mic/python/kivy-kivent-12766f1/examples/4_adding_physics_objects/kivent_cymunk/__init__.py", line 1, in <module>
from . import physics
ImportError: dynamic module does not define init function (PyInit_physics)
我已搜查了一整天,但沒有找到任何答案。 Kivent核心獨自運作,所以它必須是cymunk或kivent_cymunk的問題。我有一些問題使用python3來構建這些模塊,所以如果你有一個很好的建議來安裝這些構建,它也將受到歡迎。
使用python3 kivent_cymunk的設置錯誤是:
building 'kivent_cymunk.physics' extension
gcc -pthread -Wno-unused-result -Werror=declaration-after-statement -DNDEBUG -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DOPENSSL_LOAD_CONF -fPIC -I/usr/include/python3.4m -c kivent_cymunk/physics.c -o build/temp.linux-x86_64-3.4/kivent_cymunk/physics.o -std=c99 -ffast-math
In file included from kivent_cymunk/chipmunk/chipmunk.h:116:0,
from kivent_cymunk/physics.c:253:
kivent_cymunk/chipmunk/constraints/cpConstraint.h: In function ‘cpConstraintActivateBodies’:
kivent_cymunk/chipmunk/constraints/cpConstraint.h:94:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
cpBody *b = constraint->b; if(b) cpBodyActivate(b);
^
cc1: some warnings being treated as errors
error: command 'gcc' failed with exit status 1
我的系統是:OpenSuse當中13.2。
我希望我能解釋這個問題,任何人都可以提供幫助。
在此先感謝!
有誰在Python 3使用Kivent與cymunk? – magenulcus