-1

I had a hard time installing pygame on my ubuntu 16.04 LTS. I use python 3. these are the steps I took to install pygame:

1.first I installed pip:

sudo python3 get-pip.py

this is the output of running pip --version:

pip 10.0.1 from /usr/local/lib/python3.5/dist-packages/pip (python 3.5)
  1. I executed the following commands:

sudo apt-get install python3-dev mercurial

sudo apt-get install libsdl-image1.2-dev libsdl2-dev libsdl-ttf2.0-dev

  1. then I executed the following command:

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

and this is the result in terminal:

Collecting hg+http://bitbucket.org/pygame/pygame
  Cloning hg http://bitbucket.org/pygame/pygame to /tmp/pip-req-build-hxy86__i
abort: error: Connection reset by peer
Command "hg clone --noupdate -q http://bitbucket.org/pygame/pygame /tmp/pip-req-build-hxy86__i" failed with error code 255 in None

and it fails to install pygame. what should I do??

3

To install PyGame for Python 3.x on Ubuntu 16.04 (default python3 is version 3.5.1) open the terminal and type:

sudo apt install python3-setuptools
sudo easy_install3 pip
sudo pip3.5 install pygame

To install PyGame for Python 3.x on Ubuntu 18.10 and later 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 # for 19.04 replace cosmic with disco 

Save sources.list with the keyboard combination Ctrl+O and press Enter and exit with Ctrl+X

Update the list of available software and install python3-pygame.

sudo apt update  
sudo apt install python3-pygame

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.