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

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

问题描述

我正在尝试安装 Pygame.我正在使用 Enthought Python Distribution 运行 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 错误 HTTP 错误,无法安装需求 Pygame400:错误的 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.p>

  • 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天全站免登陆