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
2,225 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
1,076 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
10,586 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
513 views
+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 1,465 views
0 votes
0 answers
+4 votes
6 answers

Lowercase in Python

You can simply the built-in function in ...READ MORE

answered Apr 11, 2018 in Python by hemant
• 5,800 points
1,094 views
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
8,218 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,250 points
4,383 views