1

I am trying to import pygame in V.S. Code on MacOS, but, it throws me an error:-

Unable to import 'pygame' pylint(import-error)[1,1]

I have already installed pygame using:-

pip install pygame

But, when I run the code, the output shows:-

pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html

Would appreciate it if anyone could please let me know how could I resolve this issue and import pygame successfully on V.S. Code on MacOS! Thanks for the help:)

Pressing_Keys_24_7
  • 1,755
  • 2
  • 7
  • 33
  • Why are you installing Pygame version 1.9.6? The latest version is 2.0.1 – Rabbid76 Jan 30 '21 at 16:06
  • @Rabbid76 I just typed the command pip install pygame in terminal! And, didn't mentioned any specific version go Pygame! – Pressing_Keys_24_7 Jan 30 '21 at 16:07
  • 1
    I've also run this command by the past and I needed to type manually `pip install --upgrade pygame` to get the newer version. Now there is no problem after reinstalling python, maybe it is because the `pip` version was too old. – D_00 Jan 30 '21 at 16:10
  • 1
    I think the duplicate closure is wrong. It is not about installing pygame, but rather pylint on VS Code not finding the path to the site-packages where pygame is *already* installed Running the code works as OP mentioned, so it is *already* installed. Just need to configure pylint. – Gino Mempin Feb 27 '21 at 04:28
  • @GinoMempin Thanks for your help! Highly Appreciate it:) – Pressing_Keys_24_7 Feb 27 '21 at 18:38
  • Possibly better duplicate: [Pylint “unresolved import” error in Visual Studio Code](https://stackoverflow.com/q/53939751/2745495) – Gino Mempin Feb 28 '21 at 04:12

0 Answers0