Skip to main content
 首页 » 编程设计

Python之Pygame For android 错误

2025年05月04日14落叶无声

我正在关注 the documentation of pgs4a ,在构建部分我得到了一个 WindowsError [Error 2]。
命令和回溯:

C:\Users\karuna\Desktop\Jython\Python\pgs4a-0.9.4>android.py build "C:\Users\karuna\Desktop\Jython\P 
ython\pgs4a-0.9.4\mygame" release install 
 
Updating build files. 
 
Traceback (most recent call last): 
  File "C:\Users\karuna\Desktop\Jython\Python\pgs4a-0.9.4\android.py", line 66, in <module> 
    main() 
  File "C:\Users\karuna\Desktop\Jython\Python\pgs4a-0.9.4\android.py", line 54, in main 
    build.build(iface, args.argument[0], args.argument[1:]) 
  File "buildlib\build.py", line 301, in build 
    build_core(iface, directory, commands) 
  File "buildlib\build.py", line 221, in build_core 
    subprocess.call([plat.android, "update", "project", "-p", '.', '-t', 'android-8', '-n', versione 
d_name]) 
  File "C:\Python2.7 For Chintoo\lib\subprocess.py", line 493, in call 
    return Popen(*popenargs, **kwargs).wait() 
  File "C:\Python2.7 For Chintoo\lib\subprocess.py", line 679, in __init__ 
    errread, errwrite) 
  File "C:\Python2.7 For Chintoo\lib\subprocess.py", line 893, in _execute_child 
    startupinfo) 
WindowsError: [Error 2] The system cannot find the file specified 

很明显,
我使用的是 Windows 7,并且:

  • python 2.7.3
  • JDK
  • 安卓模拟器
  • 我的 Sony Tipo 的设备驱动程序。

请帮忙!
顺便一提, 我宁愿先在我的手机上运行它。我正在考虑稍后(在教程完成后)转移到模拟器。

这个问题是不是更适合https://android.stackexchange.com/ ?

请您参考如下方法:

我不确定这对你来说是否仍然是个问题,但我最近遇到了类似的问题并设法解决了它,所以我会在这里留下一个便条。

如果有人遇到这种错误,请转到 pgs4a 文件夹和 android-sdk 文件夹。在那里,运行 SDK Manager.exe 文件。您将看到一个工具列表和不同的 Android 版本。尝试找到您正在使用的版本并安装“卸载”的所有内容。

我设法通过在当前和以前的 Android 版本下安装所有内容来解决上述问题。希望这会帮助遇到同样问题的任何人!