Python - Pygame 在安卓上的错误

2 投票
2 回答
575 浏览
提问于 2025-04-17 15:59

我在按照 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
  • Android 模拟器
  • 我索尼 Tipo 的设备驱动程序。

请帮帮我!
顺便说一下,我更希望先在我的手机上运行这个程序。等教程完成后,我再考虑使用模拟器。

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

2 个回答

0

把文件夹 android-sdk-windows 改名为 android-sdk。

1

我不确定这对你来说是否还是个问题,但我最近遇到了类似的情况,并且成功解决了,所以我在这里留个小提示。

如果有人遇到这种错误,可以去到pgs4a文件夹和android-sdk文件夹。在那里,运行SDK Manager.exe这个文件。你会看到一份工具和不同安卓版本的列表。试着找到你正在使用的版本,然后安装所有标记为“未安装”的东西。

我通过安装我当前和之前的安卓版本下的所有内容解决了这个问题。希望这能帮助到遇到同样问题的人!

撰写回答