Python error "ImportError: No module named pygame.locals"

0 votes

I'm trying to build some random game on python as apart of my project. It's a very simple game but I keep getting me the following error:

ImportError: No module named pygame.locals

How do I get rid of it?

Jun 18, 2019 in Python by Harsha
980 views

1 answer to this question.

0 votes

You need to download and install the pygame module provided by python. 

To download and install on Pycharm, follow these steps:

Goto File -> Settings -> click on the tiny plus sign on the right top corner as shown below.

You'll see a search tab, type the module name there. In your case its pygame.

Finally, click on install package and you're good to go!

answered Jun 18, 2019 by Greg

Related Questions In Python

0 votes
1 answer

Package installed but still says "ImportError: No module named pygame.locals"

So Harsha, you Import the module first ...READ MORE

answered Jun 18, 2019 in Python by Varsha
562 views
0 votes
1 answer
0 votes
2 answers

Python error "ImportError: No module named 'tkinter'"

sudo apt-get install python3-tk Then, >> import tkinter # ...READ MORE

answered Nov 9, 2019 in Python by Icetutor
• 160 points
3,800 views
0 votes
1 answer

Python error "ImportError: No module named SpeechRecognition"

Hi @Hannah, replace  import SpeechRecognition as sr with import speech_recognition ...READ MORE

answered Oct 3, 2019 in Python by Yamini
206 views
0 votes
1 answer
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 777 views
0 votes
0 answers
+4 votes
6 answers
0 votes
1 answer

Python error " import requests ImportError: No module named requests"

Hi @Vasgi, for the code you're trying ...READ MORE

answered Aug 5, 2019 in Python by Layla
2,957 views
0 votes
1 answer

No module named urllib3

It is possible that either urllib3 is ...READ MORE

answered Jan 24, 2019 in Python by SDeb
• 13,230 points
2,916 views