You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Buildozer将Pygame转Android时遇Cython编译错误求助

使用Buildozer打包Pygame到Android时的Cython编译错误求助

我正按照指导文档使用Buildozer将Python Pygame项目转换为Android应用,此前的错误已解决,但遇到以下Cython编译问题无法处理:

Error compiling Cython file:
------------------------------------------------------------
...
import sys
import traceback

include "jnius_compat.pxi"
include "jni.pxi"
include "config.pxi"
^
------------------------------------------------------------

jnius/jnius.pyx:100:0: 'config.pxi' not found

Error compiling Cython file:
------------------------------------------------------------

include "jnius_compat.pxi"
include "jni.pxi"
inc`lude "config.pxi"

IF JNIUS_PLATFORM == "android":
  ^
------------------------------------------------------------

jnius/jnius.pyx:102:3: Compile-time name 'JNIUS_PLATFORM' not defined

Error compiling Cython file:
------------------------------------------------------------
...
include "jni.pxi"
include "config.pxi"

IF JNIUS_PLATFORM == "android":
include "jnius_jvm_android.pxi"
ELIF JNIUS_PLATFORM == "win32":
    ^
------------------------------------------------------------

jnius/jnius.pyx:104:5: Compile-time name 'JNIUS_PLATFORM' not defined

Error compiling Cython file:
------------------------------------------------------------
include "config.pxi"
^
------------------------------------------------------------
jnius/jnius_jvm_dlopen.pxi:1:0: 'config.pxi' not found

我尝试过更新、安装不同版本的Cython,也更新了JDK版本,但问题仍未解决。根据使用的Cython版本(新旧不同),还会出现以下提示:

jnius/jnius.pyx:100:0: 'config.pxi' not found
警告: jnius/jnius.pyx:102:0: 'IF'语句已被弃用,将在未来的Cython版本中移除。请考虑使用运行时条件或C宏替代。

内容的提问来源于stack exchange,提问作者Christian Hidalgo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.04 16:25:56