Open your PyCharm project. Go to File->Settings->Project->Project Interpreter. There will be a list of all installed modules on the current python environment you are using. If pygame is not listed there, it hasn't been installed for that PyCharm project (using that python environment).

You can install it by using PyCharm interface, just click on the + sign and search for pygame and click install.
Answer from Dinko Pehar on Stack OverflowOpen your PyCharm project. Go to File->Settings->Project->Project Interpreter. There will be a list of all installed modules on the current python environment you are using. If pygame is not listed there, it hasn't been installed for that PyCharm project (using that python environment).

You can install it by using PyCharm interface, just click on the + sign and search for pygame and click install.
I think I solve the problem. I had the same problem as well and the reason is I think you need to specify version and fill in the option before you click the install button in Pycharm. For example my version is 1.9.6 and the option is I fill in the sentences below the Author which is "A community project". This is basically how i solve my problem try to get pygame install in my pycharm. I hope you are having the same problem too.
So go to : File->Settings->Project->Project Interpreter
Click the plus button '+' on the top right window Search for pygame and fill in the version and option Install Package It works for me at last!
python - Cannot install pygame in Pycharm - Stack Overflow
python - Can't import pygame in PyCharm - Stack Overflow
Pygame in PyCharm CE (import problem)
Unable to import PyGame in PyChart
Don't mind the username, haven't used Reddit in years to get rid of my addiction of the app
More on reddit.comVideos
Well, you don't have to download it for PyCharm here. You probably know how it checks your code. Through the interpreter! You don't need to use complex command lines or anything like that. You need to is:
Download the appropriate interpreter with PyGame included
Open your PyCharm IDE (Make sure it is up to date)
Go to
FilePress
Settings(Or Ctrl + Alt + S)Double click on the option that looks like
Project: Name_of_ProjectClick on
Project InterpreterChoose the interpreter you want to use that includes PyGame as a module
Save your options
And you are ready to go! Here is an alternate (I have never done this, please try to test it)
- Add PyGame in the same folder as your PyCharm file (Your PyCharm stuff is always in a specific file placed by you during installation/upgrade) Please consider putting your PyCharm stuff inside a folder for easy access.
I hope this helps you!
For PyCharm 2017 do the following:
- File - Settings
- Double click on your project name
- Select Project Interpreter
- Click on green + button on the right side of the window
- Type Pygame in search window
- Click Install package.
Not I'm saying that the answers above won't work, but it might be frustrating to a newbie to do command line magic.
In your py script:
import sys
##lets check if this module appears in the sys.path
exist = False
for path in sys.path:
if 'pygame' in path:
print path
exist = True
if not exist:
sys.path.append('... the path to the pygame dir.. where the __init__.py')
I recommend do add the path of pygame to the PYTHONPATH environement variable of the shell you want to execute your script from. rather than editing the sys.path in py script directly.
PYTHONPATH is an environment variable which you can set to add additional directories where python will look for modules and packages. e.g.:
If you are in windows you can use the set command to extend PYTHONPATH.
in linux:
# make python look in the pygameDirPath subdirectory of your home directory for
# modules and packages
export PYTHONPATH=${PYTHONPATH}:${HOME}/pygameDirPath
This also happens when you don't configure your virtual environment correctly.
Make sure that you select the check box Inherit Global Site Packages when you are creating the project.

The main purpose of virtual environments is to manage settings and dependencies of a particular project regardless of other Python projects.
Hello everyone,
So I tried to install PyGame for a project, but PyCharm (my IDE) don't recognize PyCharm when I try to import it
I did the following:
In my cmd, I wrote " python3 -m pip install -U pygame --user"
It did everything right, I even tested it and it turned out fine.
But when I write "import pygame" in PyCharm, the IDE doesn't recognize it.
(I'm using Python 3.9 btw)
To ensure proper setup, you can download pygame from PyCharm directly.


You should now be able to import pygame and use them in your scripts.
Most of the time it's due to not having the interpreter installed.
On terminal:
- pip install pylint (to install globally)
- Restart pycharm and click on install package "pygame" over the error it shows. This also applies for most of the other packages.
If you are using VsCode or any other, just pip install pygame (or any other needed) and it should be working.
I am using python 3.10 or 3.12 with Pycharm 2022.1 and the latest pip and Pygame versios! Why it just doesn’t work?
I ran “pip install pygame” through command prompt and it was successful, however when I tried installing pygame into PyCharm through the Settings > Project Interpreter > + and clicked install package on pygame, it fails and says “EOF when reading a line”.
Does anyone know how to fix this so I can install pygame into PyCharm?