Running python file from command prompt ModuleNotFoundError: No module named ‘pygame’

I have this error when running the script from terminal but works from PyCharm

C:UsersUsernamePycharmProjectsSpace Invaders>python
Traceback (most recent call last):
File “”, line 1, in
import pygame
ModuleNotFoundError: No module named ‘pygame’

This is how my file directory looks:

I am using python 3.8 and pygame 2.0.1

Should I have to install pygame globally for me to run the script from command line? I have the package installed in a virtual environment.

Product of the Month September 2016

Source link

Leave a Comment

Your email address will not be published. Required fields are marked *