2

Why does it say that pygame is already installed, but when I type import pygame in my code, it says that pygame is not recognized. I've tried many ways online but none of them worked.

I've tried reinstalling pygame, reinstalling python, and a lot of ways on the Internet, but so far no good.

  • 1
    So, what says that `pygame` is already installed? – quamrana Apr 06 '22 at 10:39
  • It says pygame is already installed when I try `pip install pygame`. –  Apr 06 '22 at 10:40
  • 1
    Ok, but where did `pip` put that library? Which version of python do you use? And where is that installed? – quamrana Apr 06 '22 at 10:41
  • Does the answer to this [question](https://stackoverflow.com/questions/63378229/pip-install-package-installed-but-python-is-not-importing) help at all? – quamrana Apr 06 '22 at 10:43
  • you might have to use `pip3 install pygame` – Ukulele Apr 06 '22 at 10:52
  • `pip --version` will show you which Python installation the default instance of `pip` is installing stuff in. It is probably not the one you expect. – BoarGules Apr 06 '22 at 12:35
  • How are you running python? I'd guess it's from an IDE like PyCharm or VS Code. If so you need to make sure that you are using the correct installation of python that has the PyGame package installed. Perhaps [this answer](https://stackoverflow.com/a/28467215/2280890) will help. – import random Apr 07 '22 at 06:07

0 Answers0