3

I installed Pygame Snippets in my Visual Studio Code and then i wrote import pygame, i always got an error

import pygame
ModuleNotFoundError: No module named 'pygame'

I looked for any ways how to fix it at the web, but nothing helped me.

Author Climent
  • 83
  • 1
  • 1
  • 8

6 Answers6

2

Pygame Snippets is just an extension on vscode. It does not install Pygame for you. Follow the getting started page for Pygame to install.

Kent Shikama
  • 3,910
  • 3
  • 22
  • 55
1

You should installl pygame package from pip, not snippets.

Snippets is a vscode feature that help you fast coding with code templates.

Nate Scarlet
  • 551
  • 5
  • 7
1

I had similar issue in vs code, basically I had 2 python installed one from microsoft store and another one from vs code software. To solve this I just uninstalled the one from microsoft store and installed pygame by pip install pygame now I am able to access the module.

FIRO
  • 11
  • 1
0

install pygame module through powershell: Use the command pip install pygame

Tomap
  • 610
  • 8
  • 22
0

To actually install pygame you need to do it from command line/terminal. The command to install is pip install pygame

lispy2010
  • 1
  • 1
  • 1
0

If you click on the dropdown button on the right of the run Button, you can click on: 'Run Python File' or 'Debug Python File'. That worked out for me.

Ey0524
  • 1
  • 1
  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 04 '22 at 20:03