无法安装 pygame_sdl2 [英] Can't install pygame_sdl2

查看:106
本文介绍了无法安装 pygame_sdl2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 .我想在 Google Play 商店中添加这个,但我需要创建一个 文件.

I'm creating a tower defense game using python and pygame. I would like to add this one on the Google Play Store, but I need to create an apk file.

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

I'm following a tutorial on GitHub: https://github.com/renpytom/rapt-pygame-example. I follow all the instructions but can't install pygame_sdl2. I use the command prompt, and use $ python setup.py install in the appropriate directory.

但它给了我这个错误:

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,但结果相同.

I tried to reinstall pygame_sdl2-master, but gave me the same result.

推荐答案

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

You need the appropriate Windows dependencies and cython. I did some researching and testing and found this solution:

  1. 安装 ,在终端中输入:
  1. Install cython, type this in a terminal:

$ pip install cython

  1. 转到您的 pygame_sdl2 目录并通过键入以下内容下载 Windows 依赖项:
  1. Go to your pygame_sdl2 directory and download the Windows dependencies by typing:

$ git clone https://github.com/renpy/p​​ygame_sdl2_windeps

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

If it's not in the pygame_sdl2 directory, just move pygame_sdl2_windeps there manually.

  1. 开始构建库:

$ python setup.py install

这篇关于无法安装 pygame_sdl2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆