Add the PPA to your system sources: sudo add-apt-repository ppa:thopiekar/pygame ,Install the package: sudo apt-get install python3-pygame ,Update the package list: sudo apt-get update ,sudo apt-get install python3-setuptools python3-pip
pip install pgzero
ruby - e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install python3
brew install sdl sdl_image sdl_mixer sdl_sound sdl_ttf
pip3 install hg + http: //bitbucket.org/pygame/pygame
pip3 install pgzero
You must install pip for python3
$ sudo apt install python3 - pip
and then, with the pip installed, install pygame
$ pip3 install pygame
To install python3-pygame in Ubuntu 19.04 and later open the terminal and type:
sudo apt install python3 - pygame
To install python3-pygame in Ubuntu 18.10 open the terminal and type:
sudo nano / etc / apt / sources.list
Add this line to sources.list.
deb http: //archive.ubuntu.com/ubuntu/ cosmic-proposed universe
Ubuntu 16.04-18.04
sudo apt install python3 - setuptools
sudo easy_install3 pip
python3 - m pip install--user pygame
I'm at a Pop-OS 20.04 machine and all of those answers didn't work for me (◉_◉). So I went to the documentation of Pygame and realized that I had to have the dependencies installed. To do that you can:
sudo apt - get install git python3 - dev python3 - setuptools python3 - numpy python3 - opengl\ libsdl - image1 .2 - dev libsdl - mixer1 .2 - dev libsdl - ttf2 .0 - dev libsmpeg - dev\ libsdl1 .2 - dev libportmidi - dev libswscale - dev libavformat - dev libavcodec - dev\ libtiff5 - dev libx11 - 6 libx11 - dev fluid - soundfont - gm timgm6mb - soundfont\ xfonts - base xfonts - 100 dpi xfonts - 75 dpi xfonts - cyrillic fontconfig fonts - freefont - ttf libfreetype6 - dev
Now you are ready to install Pygame, so git clone
their GitHub repository into your current folder and pip install
the module:
git clone https: //github.com/pygame/pygame.git
I've successfully completed the steps below in Xubuntu 16.04 LTS in order to install pygame into Python 3.5.2. ,I am using Ubuntu 13.10.I have both python 2.7 and python 3.3.I have installed pygame properly in python 2.7.How can i install it in python3.3.Does pygame support python3.3 or not?,In more recent versions of Ubuntu and Ubuntu derivatives (ex: Xubuntu 16.04 LTS), the accepted answer is missing one important dependency before calling the build command, namely: python3-setuptools. Therefore, I'm posting this answer with that dependency added. , 1 I'm running Xubuntu 16.04 LTS with Python 3.5.2. Before it would let me build it, per your instructions above, I also had to install setuptools via sudo apt-get install python3-setuptools (source: stackoverflow.com/a/14426553/4561887). Everything else worked great! – Gabriel Staples Sep 14, 2016 at 19:10
Change to your home directory.
cd~
Get Pygame source code.
sudo apt - get install mercurial
hg clone https: //bitbucket.org/pygame/pygame
cd pygame
Install dependencies.
sudo apt - get install python3 - dev python3 - numpy libsdl - dev libsdl - image1 .2 - dev\ libsdl - mixer1 .2 - dev libsdl - ttf2 .0 - dev libsmpeg - dev libportmidi - dev\ libavformat - dev libswscale - dev libjpeg - dev libfreetype6 - dev
Build and install Pygame.
python3 setup.py build sudo python3 setup.py install
So you need to download the last source code from the trunk, hopping it's not broken at this moment:
sudo apt - get install mercurial
hg clone https: //bitbucket.org/pygame/pygame
You also need to download the build dependency:
sudo apt - get build - dep pygame sudo apt - get install python3 - dev sudo apt - get install python3 - numpy
You can now run:
cd pygame python3 config.py
Install dependencies.
sudo apt - get install python3 - dev python3 - numpy libsdl - dev libsdl - image1 .2 - dev\ libsdl - mixer1 .2 - dev libsdl - ttf2 .0 - dev libsmpeg - dev libportmidi - dev\ libavformat - dev libswscale - dev libjpeg - dev libfreetype6 - dev python3 - setuptools
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. ,Make sure you install python with the "Add python to PATH" option selected. This means that python, and pip will work for you from the command line.,This comes with pygame already installed on the default raspbian installation.,Compiling and installing pygame is handled by Python's distutils. Pygame also comes with some scripts to automatically configure the flags needed to build pygame. Use the "setup.py" script to start the installation.
python3 - m pip install - U pygame--user
python3 - m pygame.examples.aliens
py - m pip install - U pygame--user
py - m pygame.examples.aliens
python3 - m pip install - U pygame--user
python3 - m pygame.examples.aliens
py - m pip install - U pygame--user
python3 - m pip install - U pygame--user
Use
pythonw
sudo apt - get install python3 - pygame