2

I have Ubuntu 16.04.1 installed, which has Python 3.5 installed. So when I run python3, Python 3.5 is running. I need to install Python 3.4 (since this is the latest version that the Pygame module supports).

How can I install Python 3.4 onto this machine? Do I have to uninstall Python 3.5? How do I run Python 3.4 if python3 runs 3.5?

1

You don't need to install Python 3.4 because there's a version of pygame ready for 3.5. Open a terminal (press Ctrl+Alt+T), and run:

sudo apt install python3-pip
pip3 install pygame

The last command gives the output:

Collecting pygame
  Downloading pygame-1.9.2rc1-cp35-cp35m-manylinux1_x86_64.whl (10.0MB)
    100% |████████████████████████████████| 10.0MB 54kB/s 
Installing collected packages: pygame
Successfully installed pygame

Note the cp35, which means it's for Python 3.5. This can be verified:

$ python3
Python 3.5.2+ (default, Sep 22 2016, 12:18:14) 
[GCC 6.2.0 20160927] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame
>>>

Note the lack of an error when importing it.


Credit to another answer dealing with the same problem on Windows.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

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