Search code examples
pythonlinuxubuntupygamepython-idle

Can't import pygame even though it is installed


I go into IDLE and type in import pygame to the shell and it gives me an error. Then I go into a new program and type in import pygame and I get the same error. I installed pygame with pip and are using python 3, version 3.6.8.

I have tried reinstalling pygame and trying to install in with sudo. I also have tried using pip3, same result.

[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license()" for more information.
>>> import pygame
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import pygame
ModuleNotFoundError: No module named 'pygame'
>>> 

Solution

  • Turns out I had to use 'pip3' and not just 'pip'. Thanks to everybody who helped.