'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


Solution 1:[1]

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 

Solution 2:[2]

Make sure you install pygame to the 'venv' folder of your project if you're using pycharm or sublime. If you are using IDLE then open command prompt by holding: windows+R then searching cmd, or if you are on mac: cmd+space and search terminal. then type pip install pygame for windows, and python -m install pygame for mac.

Solution 3:[3]

If you are using Pycharm and your stuck goto settings and then proceed to python interpreter you will see a page listing installed modules in your Pycharm project click the small plus sign and search for pygame after that click Install Package. If you still see an error message then repeat the steps, if that doesn't work try with internet connection. I'm not good with Command Prompt but there's a way with it. NOTE: I'm still a newbie in this area so I don't know if you'll consider my ideas useful Thank you

Solution 4:[4]

I suggest using the python editor 'mu' it has pygame built in, no importing or anything, just use pygame commands like normal python commands

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Józef Podlecki
Solution 2 Charlie C
Solution 3 PrinceK
Solution 4 fozzy