Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 994
NumberOneRobot Avatar asked Jul 25 '13 21:07

NumberOneRobot


People also ask

Why is pygame not installing?

The Python "ModuleNotFoundError: No module named 'pygame'" occurs when we forget to install the pygame module before importing it or install it in an incorrect environment. To solve the error, install the module by running the pip install pygame command.

Can you install pygame with pip?

The best way to install pygame is with the pip tool (which is what python uses to install packages). Note, this comes with python in recent versions. We use the --user flag to tell it to install into the home directory, rather than globally.

Does Python 3.10 support pygame?

Python doesn't support Pygame.


1 Answers

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 
like image 124
6 revs, 4 users 86% Avatar answered Sep 17 '22 21:09

6 revs, 4 users 86%