无法使用pip安装Pygame [英] Unable to install Pygame using pip

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

问题描述

我正在尝试安装Pygame.我正在运行带有Enthought Python发行版的Windows 7.我已经成功安装了pip,但是当我尝试使用pip安装Pygame时,出现以下错误:

I'm trying to install Pygame. I am running Windows 7 with Enthought Python Distribution. I successfully installed pip, but when I try to install Pygame using pip, I get the following error:

由于HTTP错误,无法安装要求的Pygame HTTP错误 400:URL请求错误..."

"Could not install requirement Pygame because of HTTP error HTTP error 400: Bad request for URL ..."

我无法通过Google搜索找到关于此问题的任何信息,但是我确实找到了另一个Stack Overflow问题,该问题促使问问者使用以下命令:

I can't find anything about this issue with a Google search, but I did find another Stack Overflow question that prompted the asker to use the following command:

pip install hg+http://bitbucket.org/pygame/pygame

这给了我以下错误:

Cannot find command hg

我不确定该怎么做,因为我通过Google搜索找到的所有内容都是针对Mac,因此我不知道我在Windows上能很好地遵循这些说明.

I'm not sure what else to do, as everything I find with a Google search is for Mac, so I don't know how well I can follow those instructions on Windows.

推荐答案

使用pip安装PyGame的步骤

  1. 安装构建依赖项(在Linux上):

  1. Install build dependencies (on linux):

sudo apt-get build-dep python-pygame

  • 安装Mercurial以使用hg(在Linux上):

  • Install mercurial to use hg (on linux):

    sudo apt-get install mercurial
    

    在Windows上,您可以使用安装程序:下载

    On Windows you can use the installer: Download

    使用pip安装PyGame:

    Use pip to install PyGame:

    pip install hg+http://bitbucket.org/pygame/pygame
    

    如果以上给出了freetype-config: not found错误(在Linux上),请尝试sudo apt-get install libfreetype6-dev,然后重复3.

    If the above gives freetype-config: not found error (on Linux), then try sudo apt-get install libfreetype6-dev and then repeat 3.

    替代方式:

    # Grab source
    hg clone https://bitbucket.org/pygame/pygame
    
    # Finally build and install
    cd pygame
    python setup.py build
    sudo python setup.py install
    

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

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