PyCharm won't import PyGame

Question:

I’m fairly new to python and decided to try PyGame only to find it won’t import.

line 1, in <module>
    import pygame
ModuleNotFoundError: No module named 'pygame'

I am on windows 10, I am using PyCharm Build #PE-182.3684.126, and I pip installed it through CMD. I have reinstalled PyGame twice so far and it still won’t work. If anyone can provide advice it would be greatly appreciated.

Asked By: IsaacWP121

||

Answers:

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).

Pygame environment

You can install it by using PyCharm interface, just click on the + sign and search for pygame and click install.

Answered By: Dinko Pehar

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!

Answered By: Fandi Fauzi

In A Short way You can Do it Open Terminal Of Pycham (you can see below downside)And Try The pip Install pygame
Its work fine for my laptop and conputer.

Answered By: LimeCraft Technical

Try pip install pygame at the terminal in pycharm, or simply click on Python Packages and search for pygame (to install it).

enter image description here

enter image description here

Answered By: CPP_is_no_STANDARD
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.