Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install pygame for python3.5 in Ubuntu16.04?

I've spent hours for installing pygame, but it I didn't succeed.

I want a detailed installing instruction for pygame in python3.5 in Ubuntu16.04.

And I think it's a meaningful work for other people.

like image 731
Fish Yu Avatar asked Mar 09 '17 23:03

Fish Yu


People also ask

How do I import pygame into Python 3?

Open a terminal, and type 'sudo apt-get install idle pygame', enter your password and type 'y' at the prompts, if necessary. 2. After the installation completes, enter 'python' in the terminal to launch Python. Verify that it's using version 2.7 or newer, then at the Python prompt enter 'import pygame'.

Does Python 3.10 support pygame?

Python doesn't support Pygame.


2 Answers

You probably do not have pip3.5 installed, so I believe you it's not been easy. So one solution may be to start installing pip3.5. Based on this article on how to install pip3 in Ubuntu, here's a possible solution for your problem.

First install setuptools for Python 3

sudo apt-get install python3-setuptools

Then install pip (which will include pip3.5):

sudo easy_install3 pip

After the previous two commands, you should have pip3.5 installed. Now you can simply do

sudo pip3.5 install pygame

I tried it on Ubuntu 16.04 and it worked.

like image 167
nbro Avatar answered Nov 02 '22 01:11

nbro


I used the following to install pip3 on ubuntu 18.04 https://linuxize.com/post/how-to-install-pip-on-ubuntu-18.04/ Basically, I did the following... sudo apt update sudo apt install python3-pip

Then I was able to install pygame with the following command ... sudo pip3 install pygame

like image 38
Christopher Demaria Avatar answered Nov 02 '22 03:11

Christopher Demaria