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.
Had this issue on macOS Sierra, where apt-get doesn't work.
Managed to solve the issue through the following steps:
First I had to install the Mercurial via Brew:
Then, I had to install Pygame dependencies:
Finally I used pip3 to install Pygame:
Hope this helps!
Caveat: I'm not familiar with the Enthought Distribution, so this might not help.
As you're trying to install on Windows, if you don't want to have to mess around with C compilers, there are pre-built binary wheels for pygame here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame
Select a package appropriate to you python version[0] and Windows architecture [1]. Download to
C:\Users\User\Download\pip install E:\env\pygame-1.9.2a0-cp27-none-win_amd64.whl
and install withpip install E:\env\pygame-1.9.2a0-cp27-none-win_amd64.whl
Mercurial binaries can be found on the same page, if you would like to install from source. This method would mean compiling pygame from source, for which you probably want to use this compiler package.
[0]
python --version
[1]
powershell "gwmi win32_operatingsystem | select osarchitecture"
Install on MAC:
The most current, best way to install pygame is always available at: https://www.pygame.org/wiki/GettingStarted
How to use pip depends on the operating system. So unless you have always updating and tested answers for 15 different operating systems then just send people to that page. All answers to this question are wrong for various different operating systems.
Currently, for windows, this is the way to install it in the cmd prompt. (If you already have pip installed, and people know what pip is... best just send people to the GettingStarted page).
py -m pip install pygame --user
Steps to install PyGame using pip
Install build dependencies (on linux):
Install mercurial to use
hg
(on linux):On Windows you can use the installer: Download
Use pip to install PyGame:
If the above gives
freetype-config: not found
error (on Linux), then trysudo apt-get install libfreetype6-dev
and then repeat 3.Alternative way:
The command below worked for me on Mac OS X El Capitan:
pip3 install pygame