Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ModuleNotFoundError when importing Pygame after pip install Pygame

I was trying to make a simple snake game in Python so I installed Pygame using pip install Pygame. After I installed it successfully, I tried importing Pygame but I got this error:

ModuleNotFoundError: No module named 'pygame'

I'm new to python so I'm really stuck. I imported the module by the code.

import pygame
like image 556
noob Avatar asked Oct 15 '22 03:10

noob


1 Answers

if you are on windows:

open cmd and then type:

    cd\

    cd /d C:\Windows

    cd /d C:\Users\username\AppData\Local\Programs\Python\Python37\Scripts

and then type the command:

    pip install pygame

if you are on Mac: just try python -m pip install pygame

if you are on linux:

    pip install pygame 
like image 116
Omer Ozhan Avatar answered Oct 19 '22 02:10

Omer Ozhan