'Importing Pygame

I have installed pip and pygame module a few hours ago and when i try to import pygame module in my python

import pygame
print("well")

file i get this error

'''

Traceback (most recent call last):
  File "f:/VSCode/Alien_Invasion/alien_invasion.py", line 2, in <module>
    from pygame import *
  File "C:\Users\3mosh\AppData\Roaming\Python\Python37\site-packages\pygame\__init__.py", line 130, in <module>
    from pygame.base import *
ModuleNotFoundError: No module named 'pygame.base'

'''



Solution 1:[1]

Uninstall pygame before attempting each install with pip3 uninstall pygame.

Try using pip3 install pygame

if that doesn't work, try pip install pygame-menu==2.0.1

Also, if you have python installed multiple times, it could be installed on one of those.

Solution 2:[2]

If you are using Pycharm, go to File --> Settings --> Project settings --> Python interpreter. Here you can choose whatever package you want, then just click apply and it should work. I had the same problem, for me this worked.

Solution 3:[3]

You could use an interpreter with pygame built in (mu), which should work out of the box.

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 itsanantk
Solution 2 jester
Solution 3 fozzy