Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
230 views
in Technique[技术] by (71.8m points)

python - Unable to install Pygame using pip

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:

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

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

This gave me the following error:

Cannot find command hg

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Steps to install PyGame using pip

  1. Install build dependencies (on linux):

    sudo apt-get build-dep python-pygame
    
  2. Install mercurial to use hg (on linux):

    sudo apt-get install mercurial
    

    On Windows you can use the installer: Download

  3. Use pip to install PyGame:

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

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

Alternative way:

# Grab source
hg clone https://bitbucket.org/pygame/pygame

# Finally build and install
cd pygame
python setup.py build
sudo python setup.py install

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...