通过pip错误安装pygame [英] Installing pygame through pip error

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

问题描述

我正在尝试安装pygame以通过pip与python一起使用,但是当我使用命令pip install pygame时,它开始工作并且在抛出错误之前看起来还不错.这是我得到的输出,我不确定我是否正确执行了什么,还是什么,我是pip的新手,所以我不确定.任何帮助将不胜感激!

I'm trying to install pygame to work with python through pip, however when I use the command pip install pygame, it begins working and seems alright until it throws an error. This is the output I get, I'm not sure if i'm doing it correctly or what, I'm new to pip so I'm just not sure. Any help would be appreciated!

C:\Users\Matthew>pip install pygame
Collecting pygame
  Using cached pygame-1.9.2.tar.gz
    Complete output from command python setup.py egg_info:


    WARNING, No "Setup" File Exists, Running "config.py"
    Using WINDOWS configuration...

    Path for SDL not found.
    Too bad that is a requirement! Hand-fix the "Setup"
    Path for FONT not found.
    Path for IMAGE not found.
    Path for MIXER not found.
    Path for PNG not found.
    Path for JPEG not found.
    Path for PORTMIDI not found.
    Path for COPYLIB_tiff not found.
    Path for COPYLIB_z not found.
    Path for COPYLIB_vorbis not found.
    Path for COPYLIB_ogg not found.

    If you get compiler errors during install, doublecheck
    the compiler flags in the "Setup" file.


    Continuing With "setup.py"
    Error with the "Setup" file,
    perhaps make a clean copy from "Setup.in".
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\Matthew\AppData\Local\Temp\pip-build-kzk4_t2_\pygame\setup.
py", line 165, in <module>
        extensions = read_setup_file('Setup')
      File "c:\users\matthew\appdata\local\programs\python\python36-32\lib\distu
tils\extension.py", line 171, in read_setup_file
        line = expand_makefile_vars(line, vars)
      File "c:\users\matthew\appdata\local\programs\python\python36-32\lib\distu
tils\sysconfig.py", line 410, in expand_makefile_vars
        s = s[0:beg] + vars.get(m.group(1)) + s[end:]
    TypeError: must be str, not NoneType

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\Matthew\
AppData\Local\Temp\pip-build-kzk4_t2_\pygame\

推荐答案

这是一个老问题,但该错误通常与Python和PyGame的不兼容版本有关.您应该检查所使用的Python版本是否与PyGame的版本兼容.

This is an old question, but the error is usually related with incompatible versions of Python and PyGame. You should check if the version of Python you're using is compatible with the version of PyGame.

您可能需要安装特定版本的PyGame,例如python -m pip install pygame==1.9.3

You may need to install a specific version of PyGame, e.g. python -m pip install pygame==1.9.3

我一直在将PyGame 1.9.3与Python 3.6.8结合使用,并且运行良好

I've been using PyGame 1.9.3 with Python 3.6.8 and it's working just fine

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

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