0

I am trying to import pygame in a venv. However, after I activate the venv and enter

pip install pygame 

into the cmd prompt, I am told the

requirement is satisfied 

yet when I run my code it says:

ModuleNotFoundError: no module named 'pygame' 

Can someone please tell me why this is not working, thank you.enter image description here

Error message Requirement satisfied to import pygame

Pranav Hosangadi
  • 23,755
  • 7
  • 44
  • 70
Mahirah
  • 25
  • 5
  • Are you importing pygame in the first line of the code you have provided? Otherwise you're doing "from" imports and never importing pygame itself – Guillermo J. Aug 04 '20 at 15:16
  • Have you tried typing: pip list to see if it appears ? – Alfredo Mauri Aug 04 '20 at 15:16
  • Try `python -m pip install pygame` rather than `pip install pygame`. To verify, you can check which interpreter `pip` is pointing to by comparing `python -m pip -V` and `pip -V` – C.Nivs Aug 04 '20 at 15:41
  • @Guillermo J. No, I did put import pygame above that line – Mahirah Aug 04 '20 at 16:30
  • @Alfredo Mauri I typed that in, and it does include pygame in the list, but I still don't understand why the program just doesn't run – Mahirah Aug 04 '20 at 16:31
  • I think that the pip you are using is pointing to a different version of Python, most probably Python2. Do you have multiple versions installed? – MysteryCoder456 Aug 05 '20 at 07:01
  • @Kingsley Thank you, this is working now! – Mahirah Aug 07 '20 at 17:45

0 Answers0