无法安装 pygame_sdl2

Can't install pygame_sdl2

我正在使用 and . I would like to add this one on the Google Play Store, but I need to create an 文件创建塔防游戏。

我正在学习 GitHub 上的教程: https://github.com/renpytom/rapt-pygame-example。 我按照所有说明进行操作,但无法安装 pygame_sdl2。 我使用命令提示符,在相应的目录下使用$ python setup.py install

但是它给了我这个错误:

C:\Users\gomes\Downloads\pygame_sdl2-master>python setup.py install
Traceback (most recent call last):
  File "setup.py", line 59, in <module>
    parse_cflags([ "sh", "-c", "sdl2-config --cflags" ])
  File "C:\Users\gomes\Downloads\pygame_sdl2-master\setuplib.py", line 93, in parse_cflags
    output = subprocess.check_output(command, universal_newlines=True)
  File "C:\Python27\lib\subprocess.py", line 212, in check_output
    process = Popen(stdout=PIPE, *popenargs, **kwargs)
  File "C:\Python27\lib\subprocess.py", line 390, in __init__
    errread, errwrite)
  File "C:\Python27\lib\subprocess.py", line 640, in _execute_child
    startupinfo)
WindowsError: [Error 2] Le fichier spÚcifiÚ est introuvable

我尝试重新安装 pygame_sdl2-master,但给了我同样的结果。

您需要适当的 Windows 依赖项和 。我做了一些研究和测试并找到了这个解决方案:

  1. 安装 ,在终端中输入:

$ pip install cython

  1. 转到您的 pygame_sdl2 目录并通过键入以下内容下载 Windows 依赖项:

$ git clone https://github.com/renpy/pygame_sdl2_windeps

如果它不在 pygame_sdl2 目录中,只需手动将 pygame_sdl2_windeps 移动到那里。

  1. 开始构建库:

$ python setup.py install

我直接在github上下载了pygame_sdl2_windeps。我已经将这个复制到 pygame_sdl2 目录,并在命令提示符下使用 "python setup.py install" 命令,它成功了 !!!

C:\PGS4A\pygame_sdl2>python
Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame_sdl2
>>>

感谢您的帮助!!!