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!
Answer from Anthony Pham on Stack OverflowWell, 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.
Videos
Why won't Pygame install in PyCharm?
Does Pygame work with PyCharm Community Edition?
Why does PyCharm say 'No module named pygame' even after installation?
I'm currently trying to import PyGame into PyCharm. Everything I tried didn't work. Could someone please explain how to do it? (MacOS X Catalina, PyCharm 2020.1)
I want to use pycharm to program some with pygame. Are there any gotchas that I would need to be aware of? Will it work and will it be able to run the pygame visuals? I am assuming it will work, and wondering how to setup pycharm to use pygame libraries/code?
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.
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.
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!
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?
Uninstall pygame before attempting each install with pip3 uninstall pygame.
Try using pip3 install pygame
if that doesn't work, try pip install pygame-menu==2.0.1
Also, if you have python installed multiple times, it could be installed on one of those.
If you are using Pycharm, go to File --> Settings --> Project settings --> Python interpreter. Here you can choose whatever package you want, then just click apply and it should work. I had the same problem, for me this worked.
