Import pygame ошибка

I have installed python 3.3.2 and pygame 1.9.2a0. Whenever I try to import pygame by typing:

import pygame  

I get following error message :

Python 3.3.2 (v3.3.2:d047928ae3f6, May 16 2013, 00:03:43) [MSC v.1600 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import pygame
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import pygame
ImportError: No module named 'pygame'
>>> 

I went through some of the questions related to this error but none of the solution helped.
I have 64 bit machine with Win7 OS.

user_na's user avatar

user_na

2,1641 gold badge16 silver badges36 bronze badges

asked Aug 19, 2013 at 15:26

user2398618's user avatar

5

go to python/scripts folder, open a command window to this path, type the
following:

C:\python34\scripts> python -m pip install pygame

To test it, open python IDE and type

import pygame

print (pygame.ver)

It worked for me…

LoukasPap's user avatar

LoukasPap

1,2541 gold badge8 silver badges17 bronze badges

answered May 4, 2017 at 9:33

Srikar Madhavapeddy's user avatar

3

Here are instructions for users with the newer Python 3.5 (Google brought me here, I suspect other 3.5 users might end up here as well):

I just successfully installed Pygame 1.9.2a0-cp35 on Windows and it runs with Python 3.5.1.

  • Install Python, and remember the install location
  • Go here and download pygame-1.9.2a0-cp35-none-win32.whl
  • Move the downloaded .whl file to your python35/Scripts directory
  • Open a command prompt in the Scripts directory (ShiftRight click in the directory > Open a command window here)
  • Enter the command:

    pip3 install pygame-1.9.2a0-cp35-none-win32.whl

  • If you get an error in the last step, try:

    python -m pip install pygame-1.9.2a0-cp35-none-win32.whl

And that should do it. Tested as working on Windows 10 64bit.

answered Apr 11, 2016 at 16:02

charlie's user avatar

charliecharlie

8561 gold badge11 silver badges17 bronze badges

4

I was trying to figure this out for at least an hour. And you’re right the problem is that the installation files are all for 32 bit.

Luckily I found a link to the 64 pygame download! Here it is: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame

Just pick the corresponding version according to your python version and it should work like magic. The installation feature will bring you to a bright-blue screen as the installation (at this point you know that the installation is correct for you.

Then go into the Python IDLE and type «import pygame» and you should not get any more errors.

Props go to @yuvi who shared the link with StackOverflow.

answered May 1, 2014 at 23:27

aaron-coding's user avatar

aaron-codingaaron-coding

2,5811 gold badge23 silver badges31 bronze badges

5

  1. open the folder where your python is installed
  2. open scripts folder
  3. type cmd in the address bar. It opens a command prompt window in that location
  4. type pip install pygame and press enter
  5. it should download and install pygame module
  6. now run your code. It works fine :-)

answered Dec 28, 2017 at 5:42

NARENDER REDDY's user avatar

I had the same problem and discovered that Pygame doesn’t work for Python3 at least on the Mac OS, but I also have Tython2 installed in my computer as you probably do too, so when I use Pygame, I switch the path so that it uses python2 instead of python3. I use Sublime Text as my text editor so I just go to
Tools > Build Systems > New Build System and enter the following:

{
    "cmd": ["/usr/local/bin/python", "-u", "$file"],    
}

instead of

{
    "cmd": ["/usr/local/bin/python3", "-u", "$file"],   
}

in my case. And when I’m not using pygame, I simply change the path back so that I can use Python3.

General Failure's user avatar

answered Dec 26, 2016 at 6:34

Megan Chang's user avatar

The current PyGame release, 1.9.6 doesn’t support Python 3.9. I fyou don’t want to wait for PyGame 2.0, you have to use Python 3.8. Alternatively, you can install a developer version by explicitly specifying the version (2.0.0.dev20 is the latest release at the time of writing):

pip install pygame==2.0.0.dev20

or try to install a pre-release version by enabling the --pre option:

pip install pygame --pre

answered Oct 23, 2020 at 5:51

Rabbid76's user avatar

Rabbid76Rabbid76

203k27 gold badges134 silver badges178 bronze badges

Resolved !

Here is an example

C:\Users\user\AppData\Local\Programs\Python\Python36-32\Scripts>pip install pygame

John's user avatar

John

2,6334 gold badges19 silver badges34 bronze badges

answered Nov 29, 2019 at 16:43

diego lara's user avatar

try this in your command prompt:
python -m pip install pygame

Oscar Nguyen's user avatar

answered Feb 18, 2021 at 17:21

Ace Standard's user avatar

I was getting the same error. It is because your version of Pygame is not compatible with your version of Python or Pydev. Go to this link and get the proper version of Pygame for your current version of Python. Ctrl F to find it faster or click on the word python in blue. up at the top. While you instal Pygame it should find the Python path by itself. At least mind did any ways. I run Pygame through Eclipse with Python 3.4.

http://www.lfd.uci.edu/~gohlke/pythonlibs/

answered Nov 14, 2014 at 2:20

TriGeo's user avatar

TriGeoTriGeo

351 silver badge6 bronze badges

1

Since no answer stated this:

Make sure that, if you are using a virtual environment, you have activated it before trying to run the program.

If you don’t really know if you are using a virtual environment or not, check with the other contributors of the project. Or maybe try to find a file with the name activate like this: find . -name activate.

answered May 31, 2017 at 8:08

user2089810's user avatar

  1. Install and download pygame .whl file.
  2. Move .whl file to your python35/Scripts
  3. Go to cmd
  4. Change directory to python scripts
  5. Type:

    pip install pygame
    

Here is an example:

C:\Users\user\AppData\Local\Programs\Python\Python36-32\Scripts>pip install pygame

Stephen Rauch's user avatar

Stephen Rauch

47.9k31 gold badges107 silver badges136 bronze badges

answered Dec 14, 2017 at 3:35

EDGE 074's user avatar

I just encountered the same problem and found that I am having multiple interpreters of the different versions installed in my system and pygame got installed in one of them when I installed it using command but in my IDE another interpreter was selected so this messed up my system, try to see if you are also having the same situation.

answered Jun 26, 2021 at 15:47

Tanishq chandra's user avatar

Just use this command in the terminal python3 -m pip install -U pygame --user

answered Sep 22, 2022 at 14:51

Eduardo-Puentes's user avatar

You don’t need 64 bit Python on Win64 system, just install the 32bit versions of both Python and Pygame and they will work just fine (and there is a ton more modules for them anyways).

answered Aug 18, 2014 at 21:58

KalELonRedKryptonite's user avatar

3

I’m using the PyCharm IDE. I could get Pygame to work with IDLE but not with PyCharm. This video helped me install Pygame through PyCharm.

(It seems that PyCharm only recognizes a package; if you use its GUI.)

However, there were a few slight differences for me; because I’m using Windows instead of a Mac.

My “preferences” menu is found in: File->Settings…

Then, in the next screen, I expanded my project menu, and clicked Project Interpreter. Then I clicked the green plus icon to the right to get to the Available Packages screen.

answered Mar 6, 2018 at 12:34

Joe's user avatar

JoeJoe

8,2713 gold badges18 silver badges23 bronze badges

I ran into the error a few days ago! Thankfully, I found the answer.

You see, the problem is that pygame comes in a .whl (wheel) file/package. So, as a result, you have to pip install it.

Pip installing is a very tricky process, so please be careful. The steps are:-

Step1. Go to C:/Python (whatever version you are using)/Scripts. Scroll down. If you see a file named pip.exe, then that means that you are in the right folder. Copy the path.

Step2. In your computer, search for Environment Variables. You should see an option labeled ‘Edit the System Environment Variables’. Click on it.

Step3. There, you should see a dialogue box appear. Click ‘Environment Variables’. Click on ‘Path’. Then, click ‘New’. Paste the path that you copies earlier.

Step4. Click ‘Ok’.

Step5. Shift + Right Click wherever your pygame is installed. Select ‘Open Command Window Here’ from the dropdown menu. Type in ‘pip install py’ then click tab and the full file name should fill in. Then, press Enter, and you’re ready to go! Now you shouldn’t get the error again!!!

answered Aug 28, 2018 at 21:39

First execute python3 then type the command import pygame,now you can see the output

answered Apr 16, 2020 at 11:06

Asha's user avatar

AshaAsha

8153 gold badges10 silver badges18 bronze badges

For this you have to install pygame package from the cmd (on Windows) or from terminal (on mac). Just type pip install pygame
.If it doesn’t work for you, then try using this statement pip3 install pygame .
If it is still showing an error then you don’t have pip installed on your device and try installing pip first.

answered Aug 21, 2020 at 20:04

Ansh's user avatar

AnshAnsh

566 bronze badges

make sure if you are on windows that your library directory is added to path

answered Aug 14, 2021 at 9:21

dragon445's user avatar

dragon445dragon445

1211 silver badge4 bronze badges

This may happen when pygame didn’t installed, install the pygame first

pip
pip install pygame

if dont work update the PIP by goto python install folder and type

python -m pip install --upgrade pip

hope it work

answered Aug 26, 2021 at 12:24

Azka Hamidzan F.'s user avatar

Try this solution:
Type in to cmd (Windows):

C:\Users\'Your name'> pip install -U pygame

You should remove python -m, py -m, python3 -m before the pip
Also remove --user behind it.

It will said:

C:\Users\viait>pip install -U pygame
Defaulting to user installation because normal site-packages is not writeable
Collecting pygame
  Downloading pygame-2.1.2-cp310-cp310-win_amd64.whl (8.4 MB)
     ---------------------------------------- 8.4/8.4 MB 1.7 MB/s eta 0:00:00
Installing collected packages: pygame
Successfully installed pygame-2.1.2

Then test it in your IDE or cmd:
(CMD example)

C:\Users\viait>python
Python 3.10.3 (tags/v3.10.3:a342a49, Mar 16 2022, 13:07:40) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygame
pygame 2.1.2 (SDL 2.0.18, Python 3.10.3)
Hello from the pygame community. https://www.pygame.org/contribute.html

(IDE example)

import pygame

You can do this without any errors.

answered Apr 5, 2022 at 9:17

Oscar Nguyen's user avatar

You could use

pip install pygame

but if you use IDE like PyCharm, then you could just either install it from Python Packages or use right click at the package name then left click on Show Context Actions then left click on Install package pygame

(Personally, I recommended using Python Packages for the package installing because it has documentation with it)

answered Nov 26, 2022 at 10:42

Foryxled_Dev's user avatar

You gotta use Pycharm and install it in Terminal using pip install pygame and also after that enter Pycharm and hover on pygame in the «Import pygame» and in Pycharm it will tell you to download that and you can easily download it and enjoy your result

answered Jun 4, 2021 at 14:13

Mushfiqur Rahman's user avatar

I was having the same trouble and I did

pip install pygame

and that worked for me!

answered Nov 30, 2016 at 18:38

TheHyperCake's user avatar

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.

Already on GitHub?
Sign in
to your account

Comments

@DynamicDawson

I downloaded pygame for a week now, and it still doesn’t work, when I try to install it again it shows this message:

Requirement already satisfied: pygame in ./opt/anaconda3/lib/python3.8/site-packages (2.1.0)

but when I try to run this code:

import os
import pygame
from Player import Player
from Cloud import Cloud

os.environ['SDL_VIDEO_CENTERED'] = '1'


class Game:
    def __init__(self):
        pygame.init()
        self.width = 1920
        self.height = 1080
        self.window = pygame.display.set_mode((1920, 1080))
        pygame.display.set_caption("Discover Python & Patterns - https://www.patternsgameprog.com")
        self.clock = pygame.time.Clock()
        self.x = 120
        self.y = 120
        self.speed = 4
        self.running = True
        self.down = False
        self.up = False
        self.right = False
        self.left = False
        self.player = Player()
        self.clouds = []
        for i in range(0, 5):
            self.clouds.append(Cloud(self.width, self.height, self.clouds))

    def processInput(self):
        events = pygame.event.get()
        self.player.process_input(events)
        for event in events:
            if event.type == pygame.QUIT:
                self.running = False
                break
            elif event.type == pygame.KEYDOWN:
                if event.key == pygame.K_ESCAPE:
                    self.running = False
                    break

    def update(self):
        self.player.update()
        for cloud in self.clouds:
            cloud.update()

    def render(self):
        self.window.fill((88, 11, 44))
        self.player.render(self.window)
        for cloud in self.clouds:
            cloud.render(self.window)
        pygame.display.update()

    def run(self):
        while self.running:
            self.processInput()
            self.update()
            self.render()
            self.clock.tick(60)


game = Game()
game.run()

it shows this:

Traceback (most recent call last):
  File "/Users/Yxzhang/PycharmProjects/pygame/main.py", line 2, in <module>
    import pygame
ImportError: No module named pygame

I don’t really know what my problem is.
CAN ANYONE HELP ME?

@DynamicDawson
DynamicDawson

changed the title
ImportError

ImportError: No module named pygame

Nov 15, 2021

@MyreMylar

You have multiple python installations or a virtual environment setup in
pycharm.

On Mon, 15 Nov 2021, 13:23 DynamicDawson, ***@***.***> wrote:
I downloaded pygame for a week now, and it still doesn’t work, when I try
to install it again it shows this message:

Requirement already satisfied: pygame in
./opt/anaconda3/lib/python3.8/site-packages (2.1.0)

but when I try to run this code:

import os
import pygame
from Player import Player
from Cloud import Cloud

os.environ[‘SDL_VIDEO_CENTERED’] = ‘1’

class Game:
def __init__(self):
pygame.init()
self.width = 1920
self.height = 1080
self.window = pygame.display.set_mode((1920, 1080))
pygame.display.set_caption(«Discover Python & Patterns — https://www.patternsgameprog.com»)
self.clock = pygame.time.Clock()
self.x = 120
self.y = 120
self.speed = 4
self.running = True
self.down = False
self.up = False
self.right = False
self.left = False
self.player = Player()
self.clouds = []
for i in range(0, 5):
self.clouds.append(Cloud(self.width, self.height, self.clouds))

def processInput(self):
events = pygame.event.get()
self.player.process_input(events)
for event in events:
if event.type == pygame.QUIT:
self.running = False
break
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_ESCAPE:
self.running = False
break

def update(self):
self.player.update()
for cloud in self.clouds:
cloud.update()

def render(self):
self.window.fill((88, 11, 44))
self.player.render(self.window)
for cloud in self.clouds:
cloud.render(self.window)
pygame.display.update()

def run(self):
while self.running:
self.processInput()
self.update()
self.render()
self.clock.tick(60)

game = Game()
game.run()

it shows this:

Traceback (most recent call last):
File «/Users/Yxzhang/PycharmProjects/pygame/main.py», line 2, in <module>
import pygame
ImportError: No module named pygame

I don’t really know what my problem is.
CAN ANYONE HELP ME?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2846>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADGDGGRGGAOLNU5LCCRZZK3UMECTPANCNFSM5IBVWVLA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.

@ankith26

Yeah like MyreMylar notes, the issue is probably caused due to venvs, so to fix this you can deactivate any env/anaconda environments.

But remember for future posts that pygame github issues pages are for issues of pygame itself, and not issues in your pygame based code 😄. To ask for help on that, there are many more internet forums, even a reddit sub and a discord server.

A common error you may encounter when using Python is modulenotfounderror: no module named ‘pygame’. This error occurs when Python cannot detect the pygame library in your current environment, and Pygame does not come with the default Python installation. This tutorial goes through the exact steps to troubleshoot this error for the Windows, Mac and Linux operating systems.

ModuleNotFoundError: no module named ‘pygame’

What is ModuleNotFoundError?

The ModuleNotFoundError occurs when the module you want to use is not present in your Python environment. There are several causes of the modulenotfounderror:

The module’s name is incorrect, in which case you have to check the name of the module you tried to import. Let’s try to import the re module with a double e to see what happens:

import ree
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
1 import ree

ModuleNotFoundError: No module named 'ree'

To solve this error, ensure the module name is correct. Let’s look at the revised code:

import re

print(re.__version__)
2.2.1

You may want to import a local module file, but the module is not in the same directory. Let’s look at an example package with a script and a local module to import. Let’s look at the following steps to perform from your terminal:

mkdir example_package

cd example_package

mkdir folder_1

cd folder_1

vi module.py

Note that we use Vim to create the module.py file in this example. You can use your preferred file editor, such as Emacs or Atom. In module.py, we will import the re module and define a simple function that prints the re version:

import re

def print_re_version():

    print(re.__version__)

Close the module.py, then complete the following commands from your terminal:

cd ../

vi script.py

Inside script.py, we will try to import the module we created.

import module

if __name__ == '__main__':

    mod.print_re_version()

Let’s run python script.py from the terminal to see what happens:

Traceback (most recent call last):
  File "script.py", line 1, in <module>
    import module
ModuleNotFoundError: No module named 'module'

To solve this error, we need to point to the correct path to module.py, which is inside folder_1. Let’s look at the revised code:

import folder_1.module as mod

if __name__ == '__main__':

    mod.print_re_version()

When we run python script.py, we will get the following result:

2.2.1

Lastly, you can encounter the modulenotfounderror when you import a module that is not present in your Python environment.

What is pygame?

Pygame (stylized as pygame) is a set of Python modules for writing video games. It is highly portable and runs on every platform and operating system, and Pygame does not automatically come installed with Python. The simplest way to install pygame is to use the package manager for Python called pip. The following instructions to install pygame are for the major Python version 3.

How to install pygame on Windows Operating System

First, you need to download and install Python on your PC. Ensure you select the install launcher for all users and Add Python to PATH checkboxes. The latter ensures the interpreter is in the execution path. Pip is automatically on Windows for Python versions 2.7.9+ and 3.4+.

You can check your Python version with the following command:

python3 --version

You can install pip on Windows by downloading the installation package, opening the command line and launching the installer. You can install pip via the CMD prompt by running the following command.

python get-pip.py

You may need to run the command prompt as administrator. Check whether the installation has been successful by typing.

pip --version

To install pygame with pip, run the following command from the command prompt.

pip3 install pygame

How to install pygame on Mac Operating System

Open a terminal by pressing command (⌘) + Space Bar to open the Spotlight search. Type in terminal and press enter. To get pip, first ensure you have installed Python3. You can use the package manager Homebrew to do this. To install Homebrew, run the following command from your terminal:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

Follow the steps and prompts before the installation starts, then insert the Homebrew directory at the top of your PATH environment variable. You can do this by adding the following line at the bottom of your ~/.profile file:

export PATH="/usr/local/opt/python/libexec/bin:$PATH"

Alternatively, if you have OS X 10.12 (Sierra) or older, use:

export PATH=/usr/local/bin:/usr/local/sbin:$PATH

You can check that you have Python 3 installed on your system by running:

python3 --version
Python 3.8.8

Download pip by running the following curl command:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

The curl command allows you to specify a direct download link, and using the -o option sets the name of the downloaded file.

Install pip by running:

python3 get-pip.py

From the terminal, use pip3 to install pygame:

pip3 install pygame

How to install pygame on Linux Operating System

All major Linux distributions have Python installed by default. However, you will need to install pip. You can install pip from the terminal, but the installation instructions depend on the Linux distribution you are using. You will need root privileges to install pip. Open a terminal and use the commands relevant to your Linux distribution to install pip.

Installing pip for Ubuntu, Debian, and Linux Mint

sudo apt install python-pip3

Installing pip for CentOS 8 (and newer), Fedora, and Red Hat

sudo dnf install python-pip3

Installing pip for CentOS 6 and 7, and older versions of Red Hat

sudo yum install epel-release

sudo yum install python-pip3

Installing pip for Arch Linux and Manjaro

sudo pacman -S python-pip

Installing pip for OpenSUSE

sudo zypper python3-pip

Once you have installed pip, you can install pygame using:

pip3 install pygame

Check pygame Version

Once you have successfully installed pygame, you can use two methods to check the version of pygame. First, you can use pip show from your terminal.

pip show pygame
Name: pygame
Version: 2.1.2
Summary: Python Game Development

Second, within your python program, you can import pygame and then reference the __version__ attribute:

import pygame

print(pygame.__version__)
2.1.2

Installing pygame Using Anaconda

Anaconda is a distribution of Python and R for scientific computing and data science. You can install Anaconda by going to the installation instructions. Once you have installed Anaconda, you can install pygame using the following command:

conda install -c cogsci pygame

Summary

Congratulations on reading to the end of this tutorial. The modulenotfounderror occurs if you misspell the module name, incorrectly point to the module path or do not have the module installed in your Python environment. If you do not have the module installed in your Python environment, you can use pip to install the package. However, you must ensure you have pip installed on your system. You can also install Anaconda on your system and use the conda install command to install the pygame library.

For further reading on installing data science and machine learning libraries, you can go to the articles:

  • OpenCV: How to Solve Python ModuleNotFoundError: no module named ‘cv2’
  • Requests: How to Solve Python ModuleNotFoundError: no module named ‘requests’
  • Pandas: How to Solve Python ModuleNotFoundError: no module named ‘pandas’
  • Matplotlib: How to Solve Python ModuleNotFoundError: no module named ‘matplotlib’
  • Flask: How to Solve Python ModuleNotFoundError: no module named ‘flask’

Go to the online courses page on Python to learn more about Python for data science and machine learning.

Have fun and happy researching!

Возникла проблема с импортированием билиотеки pygame в проект. При просмотре списка установленных пакетов с помощью p pygame вроде установлен, но при импортировании в проект он ругается: no module named pygame.


  • Вопрос задан

  • 6137 просмотров

Пригласить эксперта

1) Какая у вас версия python ?
2) Какая ИДЕ: PyCharm-> Сам устанавливает пакеты.
3) Установить pygame — pip install pygame
4) После установки воспользуйтесь — pip list и ищите в ней pygame если есть то по идее всё должно работать.
5) Попробуйте переустановить сначала -> pip uninstall pygame, потом пункт 3
6)По идее всё должно работать, так же работу модуля можно проверить так :
открыть консоль и написать py и в самом интерпритаторе написать import pygame если после этой строки ошибок нет, значит проблема в IDE :)


  • Показать ещё
    Загружается…

21 сент. 2023, в 14:51

30000 руб./за проект

21 сент. 2023, в 14:49

25000 руб./за проект

21 сент. 2023, в 14:33

5000 руб./за проект

Минуточку внимания

Pygame is a cross-platform Python module that allows you to develop video games. It has inbuilt computer graphics and audios that make easy development of the games. To use it you have to install it on your system. Many programmers are not able to install pygame module in their system and get the no module named pygame error.

In this entire tutorial, you will know how to solve the ModuleNotFound: no module named ‘pygame’ error.

Why do you get the ModulNotFound Error?

The modulenotfound error generally comes when you had not properly installed that python package in your system. Most of the cases are solved by just installing the package in the system.

Root Cause of no module named ‘pygame’ error

The main or root cause for getting this modulenotfound error is that you have not installed pygame in your system. And another reason is your python interpreter has not known the path of the package installed.

You will get the red underline below the package name if you try to import pygame package in pycharm.

import pygame

Output

No module named pygame error

pygame modulenotfound error

Solution of ModuleNotFoundErro: no module named ‘pygame’ error

The solution for this no module named pygame error is very simple. You have to install it in the system using the pip command.

But before that, you have to also check the version of the python. To check it open your command prompt or terminal and write the below command.

python --version

Checking the Python version

Checking the Python version

The prompt or terminal will show the python version. If it is python 3. xx then use the pip3 command and if it is python 2. xx then use the pip command.

I have already checked the version of python for my system and it is python 3. xx. Therefore I will use the pip3 command.

Run the following bash command to install the pygame package.

pip3 install pygame

Installing pygame in the system

Installing pygame in the system

After the installation, if you again import the package then you will not see the red underline and also no module named pygame error in pycharm.

Checking whether pygame is installed or not

Checking whether pygame is installed or not

Conclusion

Pygame allows you to develop video games using the python language. There are also many other programming languages to develop video games.  However, if you know knowledge of python is above good then go for it.

The above method will solve the error if you are getting no module named pygame.

Понравилась статья? Поделить с друзьями:
  • Ilife v55 pro ошибка e05
  • Immergas ошибка e44
  • Import plotly ошибка
  • Ids drive ошибка uc3
  • Import openpyxl ошибка