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.
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.
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.
Python doesn't support Pygame.
Steps to install PyGame using pip
Install build dependencies (on linux):
sudo apt-get build-dep python-pygame
Install mercurial to use hg
(on linux):
sudo apt-get install mercurial
On Windows you can use the installer: Download
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With