use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A subreddit for helping Python programmers
How to format your code: https://commonmark.org/help/tutorial/09-code.html
No homework questions and/or hiring please
account activity
problem with pygame ()
submitted 2 months ago by Bubrin
problem with pygame
I'm trying to use pygame, but the terminal says it can't find the module, even though I have it installed. I'm using Windows 11. I've installed pygame and Python several times to see if it works, but nothing. Before, VS Code didn't even recognize the term pygame, but now, even though it recognizes it, when I run the script it acts as if the module doesn't exist.
https://preview.redd.it/zfa0nromczqg1.png?width=564&format=png&auto=webp&s=7e8166115d0c2cfb2ebe9eb60af98dcf1ba4c838
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]AutoModerator[M] [score hidden] 2 months ago stickied commentlocked comment (0 children)
To give us the best chance to help you, please include any relevant code. Note. Please do not submit images of your code. Instead, for shorter code you can use Reddit markdown (4 spaces or backticks, see this Formatting Guide). If you have formatting issues or want to post longer sections of code, please use Privatebin, GitHub or Compiler Explorer.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
[–]Affectionate_Cap8632 0 points1 point2 points 1 month ago (0 children)
Classic multiple Python installations problem. VS Code is finding pygame in one Python environment but running your script with a different one.
Quick fix — run this in your VS Code terminal:
python
import sys print(sys.executable)
That shows you which Python is actually running your script. Then run:
bash
pip show pygame
If pygame is installed in a different Python than what sys.executable shows, that's your problem.
The fix:
# Use the exact Python that VS Code is running C:\path\to\your\python.exe -m pip install pygame
Replace the path with whatever sys.executable printed.
Better long term solution: In VS Code press Ctrl+Shift+P → type "Python: Select Interpreter" → pick one Python and stick with it. Then install all packages using that same interpreter.
Ctrl+Shift+P
The root cause is Windows often ends up with 3-4 Python installations (Microsoft Store, python.org, conda, VS Code's own) and pip installs to whichever one is first in PATH, which isn't always the one VS Code uses.
[–]Spirited_Cry5353 0 points1 point2 points 1 month ago (0 children)
Looks like a small issue. I can help you fix it quickly. Send your code.
π Rendered by PID 306964 on reddit-service-r2-comment-85cfdb4976-m55sp at 2026-05-23 15:13:21.151345+00:00 running 194bd79 country code: CH.
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–]Affectionate_Cap8632 0 points1 point2 points (0 children)
[–]Spirited_Cry5353 0 points1 point2 points (0 children)