Trouble importing

Hey all, this is only my first week learning Python so I am sorry if this is a basic mistake,

I want to import pygame for my script and for several hours I was doing just fine with it. After coming back to my code and reorganizing the code I am running into an issue where it errors every time I try 'import pygame'. After a google search, I tried successfully installing it through command prompt and it seems to be working that way:

Requirement already satisfied: pygame in c:\users\everett\appdata\local\programs\python\python38-32\lib\site-packages (1.9.6)

this is after installing it ^ this is in cmd.

I ran the code again in Pycharm but it still gets this error:

Traceback (most recent call last):
File "C:/Users/Everett/PycharmProjects/Platformerv.0.1/venv/Game.py", line 2, in <module>
import pygame
ModuleNotFoundError: No module named 'pygame'

after Googling about importing via pycharm I went to enable 'auto-imports' but still, nothing changed, i press on the little bulb icon and there is nothing relevant, same thing with alt-enter. It's not giving me an option to import through pycharm, just giving me the same error. Again I'm sorry if this is a basic mistake this is really only my first-week coding and I am only following online pdf's, online guides, and youtube guides.

 

edit; also another thing i'd like to add if this helps at all is in the text editor in pycharm the text/code is  colorized and not underlined at all, it looks on the outside like there is no error, only when running the code it spits out an error

edit two; I'm getting pretty confused now because pycharm helps me autofill pygame code. if i start to type something like

pygame.key.get_pressed()

it'll suggest and help autofill the ending. bet yet it still says that it can't find the module 'pygame'

 

0
1 comment

Hey! I solved it. I leave this post up for future reference for others but what I did was I went to the terminal at the bottom of pycharm and typed in 'pip install pycharm' and everything seems to be working.

1

Please sign in to leave a comment.