0

Exception Thrown: receiving "No module named 'pygame'"

Message=No module named 'pygame' Source=C:\Users\jonat\source\repos\test\test\test.py StackTrace: File "C:\Users\jonat\source\repos\test\test\test.py", line 1, in import pygame

Please help.

Thank you! Jonathan

Krzysztof Madej
  • 32,704
  • 10
  • 78
  • 107
  • on windows, command prompt, able to open python and import pygame. not sure how they connect properly. Please help! – jonathan Martinez Nov 26 '20 at 19:03
  • 1
    Are you sure that _pygame_ module is installed on your system? – Yaroslav Stetsyk Nov 26 '20 at 20:09
  • I have Visual Studio 2019 on my Win 10. Python and pip are installed as I've check through CMD. This is my first time... thank you for your patience in advance! :) C:\Users\jonat>pip3 --version pip 20.2.4 from c:\users\jonat\appdata\local\programs\python\python37-32\lib\site-packages\pip (python 3.7) C:\Users\jonat>python -m pip install -U pygame --user Requirement already up-to-date: pygame in c:\users\jonat\appdata\local\programs\python\python37-32\lib\site-packages (2.0.0) – jonathan Martinez Nov 27 '20 at 04:11
  • It is possible that Visual Studio uses different version of Python when it comes as part of VS package. Try to check version when you run in from VS: how to - https://stackoverflow.com/questions/9079036/how-do-i-detect-the-python-version-at-runtime – Yaroslav Stetsyk Nov 27 '20 at 05:36
  • I used: import sys Is there anything I need to change in orderWhen I start VS, the 'Location' is set to: " C:\Users\jonat\source\repos " -- is that ok? If so, what else would need to be set to this location for connections to work? Or am I overthinking? – jonathan Martinez Nov 27 '20 at 21:34
  • I would concentrate on Python related things. Did you get version at runtime? – Yaroslav Stetsyk Nov 27 '20 at 21:37
  • When I run the suggested code: import sys if sys.version_info[0] < 3: raise Exception("Must be using Python 3") ...I receive the window displaying " Press any key to continue..." -- I assume this is good? – jonathan Martinez Nov 27 '20 at 22:08
  • C:\Users\jonat\AppData\Local\Programs\Python\Python37-32\Lib\site-packages>pip install pygame Requirement already satisfied: pygame in c:\users\jonat\appdata\local\programs\python\python37-32\lib\site-packages (2.0.0) – jonathan Martinez Nov 27 '20 at 22:12
  • I'm an amateur, sorry. I didn't have pygame fully completed. It was downloaded, but not installed I guess. I rebooted and now I'm seeing this: pygame 2.0.0 (SDL 2.0.12, python 3.7.4) Hello from the pygame community. https://www.pygame.org/contribute.html Press any key to continue . . . ...which is good?! :))) – jonathan Martinez Nov 27 '20 at 22:39
  • I'm still confused... If I have CMD prompt open in Windows 10, type in: "python , shouldn't that run? – jonathan Martinez Nov 27 '20 at 22:51

0 Answers0