Skip to content Skip to sidebar Skip to footer

Modulenotfounderror: No Module Named 'pgzrun' When I Have It Installed?

Why does IDLE say ModuleNotFoundError: No module named 'pygame' when I have it installed? I installed it with pip. I tried deleting the import but then IDLE gives me a name error s

Solution 1:

Got to python/scripts path and try to uninstall it with python -m pip uninstall pygame then install it with python -m pip install pygame --user

When installing a python package without --user, pip defaults to installing it on the system directory such as /usr/local/lib/python3, and this requires root access. While when using --user, pip installs the package in your home directory which doesn't require any root access or special privileges. So that leaves us with two ways to install Pygame correctly, The first one is to use --user to install it without special privileges and the Second choice is to run the terminal as an administrator on Windows or as root on Linux to give it root access for it to download Pygame successfully.


Solution 2:

It could be that your IDE is using a different version of Python than the one you installed the package to. Try the following to make sure that the package is installed to python 3:

pip3 install pygame

Some code editors require a restart when new packages are installed.


Solution 3:

After installing the latest version of python3, do this:

python -m pip install pygame==1.9.6

This worked for me on macOS High Sierra and Windows 10


Solution 4:

I think It was a comment somebody made saying it was a miss configured IDE.Now I use spyder 4 And it works fine.

september 17 : Now I figured out that it was actually my path was wrong


Post a Comment for "Modulenotfounderror: No Module Named 'pgzrun' When I Have It Installed?"