Warning no setup file exists running buildconfig config py using windows configuration

WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using WINDOWS configuration...


Download prebuilts to "prebuilt_downloads" and copy to "./prebuilt-x64"? [Y/n]Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\ashut\AppData\Local\Temp\pycharm-packaging\pygame\setup.py", line 194, in <module>
    buildconfig.config.main(AUTO_CONFIG)
  File "C:\Users\ashut\AppData\Local\Temp\pycharm-packaging\pygame\buildconfig\config.py", line 210, in main
    deps = CFG.main(**kwds)
  File "C:\Users\ashut\AppData\Local\Temp\pycharm-packaging\pygame\buildconfig\config_win.py", line 576, in main
    and download_win_prebuilt.ask(**download_kwargs):
  File "C:\Users\ashut\AppData\Local\Temp\pycharm-packaging\pygame\buildconfig\download_win_prebuilt.py", line 302, in ask
    reply = raw_input(
EOFError: EOF when reading a line

----------------------------------------

Command «python setup.py egg_info» failed with error code 1 in C:\Users\ashut\AppData\Local\Temp\pycharm-packaging\pygame\

Не могу установить pip pygame и ряд других библиотек пишет

Ошибка

Collecting pygame
  Using cached pygame-2.1.2.tar.gz (10.1 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [43 lines of output]


      WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
      Using WINDOWS configuration...

      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "C:\Users\tommy\AppData\Local\Temp\pip-install-zwttycw2\pygame_ae00c7691cae43efad0cf49aa0b5fe1e\setup.py", line 359, in <module>
          buildconfig.config.main(AUTO_CONFIG)
        File "C:\Users\tommy\AppData\Local\Temp\pip-install-zwttycw2\pygame_ae00c7691cae43efad0cf49aa0b5fe1e\buildconfig\config.py", line 225, in main
          deps = CFG.main(**kwds)
                 ^^^^^^^^^^^^^^^^
        File "C:\Users\tommy\AppData\Local\Temp\pip-install-zwttycw2\pygame_ae00c7691cae43efad0cf49aa0b5fe1e\buildconfig\config_win.py", line 497, in main
          and download_win_prebuilt.ask(**download_kwargs):
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\tommy\AppData\Local\Temp\pip-install-zwttycw2\pygame_ae00c7691cae43efad0cf49aa0b5fe1e\buildconfig\download_win_prebuilt.py", line 290, in ask
          update(x86=x86, x64=x64)
        File "C:\Users\tommy\AppData\Local\Temp\pip-install-zwttycw2\pygame_ae00c7691cae43efad0cf49aa0b5fe1e\buildconfig\download_win_prebuilt.py", line 273, in update
          download_prebuilts(download_dir, x86=x86, x64=x64)
        File "C:\Users\tommy\AppData\Local\Temp\pip-install-zwttycw2\pygame_ae00c7691cae43efad0cf49aa0b5fe1e\buildconfig\download_win_prebuilt.py", line 124, in download_prebuilts
          download_sha1_unzip(url, checksum, temp_dir, 1)
        File "C:\Users\tommy\AppData\Local\Temp\pip-install-zwttycw2\pygame_ae00c7691cae43efad0cf49aa0b5fe1e\buildconfig\download_win_prebuilt.py", line 58, in download_sha1_unzip
          raise ValueError(
      ValueError: url:https://www.pygame.org/ftp/jpegsr9d.zip should have checksum:ed10aa2b5a0fcfe74f8a6f7611aeb346b06a1f99: Has:7fb085fd0732c08ba1c4a99e1a7143f722607b19:
      Making dir :prebuilt_downloads:
      Downloading... https://www.libsdl.org/release/SDL2-devel-2.0.18-VC.zip ed561079ec622b0bab5a9e02976f5d540b0622da
      Unzipping :prebuilt_downloads\SDL2-devel-2.0.18-VC.zip:
      Downloading... https://www.libsdl.org/projects/SDL_image/release/SDL2_image-devel-2.0.5-VC.zip 137f86474691f4e12e76e07d58d5920c8d844d5b
      Unzipping :prebuilt_downloads\SDL2_image-devel-2.0.5-VC.zip:
      Downloading... https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-devel-2.0.15-VC.zip 1436df41ebc47ac36e02ec9bda5699e80ff9bd27
      Unzipping :prebuilt_downloads\SDL2_ttf-devel-2.0.15-VC.zip:
      Downloading... https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-devel-2.0.4-VC.zip 9097148f4529cf19f805ccd007618dec280f0ecc
      Unzipping :prebuilt_downloads\SDL2_mixer-devel-2.0.4-VC.zip:
      Downloading... https://www.pygame.org/ftp/jpegsr9d.zip ed10aa2b5a0fcfe74f8a6f7611aeb346b06a1f99

      ---
      For help with compilation see:
          https://www.pygame.org/wiki/CompileWindows
      To contribute to pygame development see:
          https://www.pygame.org/contribute.html
      ---

      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Во вкладке Terminal в PyCharm я вводил

pip3.8 install pygame
pip3 install pygame
pip install pygame

И всегда получал вот такую ошибку:

ERROR: Command errored out with exit status 1:
     command: /sysroot/home/user/PycharmProject/???/venv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ltp9j88k/pygame/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ltp9j88k/pygame/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-un0ew218
         cwd: /tmp/pip-install-ltp9j88k/pygame/
    Complete output (12 lines):
    
    
    WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
    Using UNIX configuration...
    
    /bin/sh: sdl-config: команда не найдена
    /bin/sh: sdl-config: команда не найдена
    /bin/sh: sdl-config: команда не найдена
    
    Hunting dependencies...
    WARNING: "sdl-config" failed!
    Unable to run "sdl-config". Please make sure a development version of SDL is installed.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

В обычном Linux терминале у меня получилось установить pygame через pip
Если эту проблему не удастся решить, то напишите Python модуль для обработки событий клавиатуры который вы знаете

I’ve been trying to install pygame on pycharm but it isn’t working.I’m using a virtual env with pip version 20 and setuptools version 50 with python version 3.8
This is the error i get when trying to install it through the project interpreter section and through the terminal.

  Using cached pygame-1.9.6.tar.gz (3.2 MB)

DEPRECATION: The -b/--build/--build-dir/--build-directory option is deprecated. pip 20.3 will remove support for this functionality. A possible replacement is use the TMPDIR/TEMP/TMP environment variable, possibly combined with --no-clean. You can find discussion regarding this at https://github.com/pypa/pip/issues/8333.
    ERROR: Command errored out with exit status 1:
     command: /home/terry/PycharmProjects/SpaceInvader/venv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pycharm-packaging/pygame/setup.py'"'"'; __file__='"'"'/tmp/pycharm-packaging/pygame/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-tt74i3ja
         cwd: /tmp/pycharm-packaging/pygame/
    Complete output (29 lines):
    
    
    WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
    Using UNIX configuration...
    
    
    Hunting dependencies...
    /bin/sh: 1: sdl-config: not found
    /bin/sh: 1: sdl-config: not found
    /bin/sh: 1: sdl-config: not found
    WARNING: "sdl-config" failed!
    Package freetype2 was not found in the pkg-config search path.
    Perhaps you should add the directory containing `freetype2.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'freetype2' found
    Package freetype2 was not found in the pkg-config search path.
    Perhaps you should add the directory containing `freetype2.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'freetype2' found
    Package freetype2 was not found in the pkg-config search path.
    Perhaps you should add the directory containing `freetype2.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'freetype2' found
    WARNING: "pkg-config freetype2" failed!
    /bin/sh: 1: freetype-config: not found
    /bin/sh: 1: freetype-config: not found
    /bin/sh: 1: freetype-config: not found
    WARNING: "freetype-config" failed!
    Unable to run "sdl-config". Please make sure a development version of SDL is installed.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

I tried using the system terminal, but that also gave me an error

У меня такой вопрос. Впервые установил PyCharm Comunity version, предварительно установил pygame для python. Когда же начал делать проект, часть

import pygame

выделяется и пишет, что такой модуль не найден, хоть собирается и работает все хорошо. Почему это так? Да, оно работает нормально, но меня немного бесит данная ситуация.

5a679233e5966075385336.png

I am getting this problem too.

System Specification
CPUs Intel(R) Core(TM) i7-3540M CPU @ 3.00GHz (4 x 2990)
Memory (System) 15.91GB (5.16GB free)
Terminal ConEmu Build 191012 (preview)
Shell cmd::Cmder
Python 3.9.0a5
λ pip install -U pygame --no-input
Collecting pygame
  Using cached pygame-1.9.6.tar.gz (3.2 MB)
    ERROR: Command errored out with exit status 1:
     command: 'c:python39python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\MavaddatJavid\AppData\Local\Temp\pip-install-1ry68fti\pygame\setup.py'"'"'; __file__='"'"'C:\Users\MavaddatJavid\AppData\Local\Temp\pip-install-1ry68fti\pygame\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'rn'"'"', '"'"'n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:UsersMavaddatJavidAppDataLocalTemppip-install-1ry68ftipygamepip-egg-info'
         cwd: C:UsersMavaddatJavidAppDataLocalTemppip-install-1ry68ftipygame
    Complete output (17 lines):


    WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
    Using WINDOWS configuration...


    Download prebuilts to "prebuilt_downloads" and copy to "./prebuilt-x64"? [Y/n]Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:UsersMavaddatJavidAppDataLocalTemppip-install-1ry68ftipygamesetup.py", line 194, in <module>
        buildconfig.config.main(AUTO_CONFIG)
      File "C:UsersMavaddatJavidAppDataLocalTemppip-install-1ry68ftipygamebuildconfigconfig.py", line 210, in main
        deps = CFG.main(**kwds)
      File "C:UsersMavaddatJavidAppDataLocalTemppip-install-1ry68ftipygamebuildconfigconfig_win.py", line 576, in main
        and download_win_prebuilt.ask(**download_kwargs):
      File "C:UsersMavaddatJavidAppDataLocalTemppip-install-1ry68ftipygamebuildconfigdownload_win_prebuilt.py", line 302, in ask
        reply = raw_input(
    EOFError: EOF when reading a line
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

ERROR: Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host=’files.pythonhosted.org’, port=443): Max retries exceeded with url:…

  • Спрос: Используйте PyCharm к программе в Win10, где требуется сторонняя библиотека Pygame.
  • Предварительное решение: Установка сторонних библиотек с программным обеспечением PyCharm.
  • шаг:
  1. Нажмите на PyCharm Программное обеспечение в строке меню: Файл -> Настройки

image-20200729130433587

  1. Нажмите, в свою очередь: Проект: Plane_Battle -> Project Переводчик -> Список плагинов+«Открыть библиотеку программного обеспечения страницу поиска сторонних производителей.

Потому что мой проект называется Plane_Battle, список слева меню показывает Project Plane_Battle. Вы можете быть-> Проект: Ваше имя проекта

image-20200729130410515

  1. Введите «Pygame» Enter «Pygame» в окне поиска, искать сторонние библиотеки

    • Следующие советы могут появиться в случае неудобной скорости сети:

    <img src=»https://cdn.jsdelivr.net/gh/Leon1023/leon_pics/img/20200729151048.png» alt=»image-20200729132919968″ style=»zoom:67%;» />

    Не паникуйте, просто еще несколько раз!

  2. Программное обеспечение находит позже, нажмите кнопку установки кнопки в левом нижнем углу, ожидая, чтобы установить …

image-20200729132736538

Но, к сожалению, установка имеет ошибку!

image-20200729130330838

Нажмите на оперативное сообщение об ошибке, чтобы получить следующее сообщение:

image-20200729130042536

  • Возможная причина:

    • Загрузите исходную сеть слишком медленно, то соединение не подключен к серверу;
    • Версия PIP является слишком низкой и должна быть повышена.
  • Процесс решения:

    • Изменить загруженный адрес источника:

      Нажмите на нижний левый угол управления, а затем всплывают на следующей странице, нажмите справа плюс, добавить новый источник:

      Aliyuan:http://mirrors,aliyun.com/pypi/simple/

      Douban источник:http://pypi.douban.com/simple

      Официальный источник:https://pypi.python.org/simple

image-20200729133145018

После выбора нового источника, нажмите кнопку OK, чтобы обновить, а затем нажмите кнопку Установить Установить пакет.

К несчастью! Еще об ошибке! Действительно Действительно

  • Обновление версии PIP:

    В соответствии с модулем импорта, ошибка проворная информацию можно увидеть, мой PyCharm путьD:liangplanes_battlevenvScripts

    Следовательно, терминал для Windows входит в путь выше и обновляет PIP в рамках этого пути.

    Шаги: «WIN кнопка + г» -> CMD -> d: -> d: лян planes_battle venv Scripts ->python.exe -m pip install --upgrade pip -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

image-20200729144108600

После завершения обновления, вернитесь к шагу 4, найти Pygame после выбора, нажмите кнопку Установить в нижнем левом углу, чтобы установить пакет, продолжить установку …

К сожалению, может быть, вы можете также установить неудачными! Действительно Действительно

  • Окончательный большой трюкТак как он не может быть установлен с помощью программного обеспечения, то сообщения об ошибке, мы можем также попытаться установить в терминальной среде:

Точно так же, как и обновление метод PIP, сначала введите путь окружения проекта PyCharm и введите команду следующую строку:

python.exe -m pip install pygame -i http://pypi.douban.com/simple --trusted-host pypi.douban.com`

Источник Douban используется, конечно, вы можете также изменить его на официальный источник Али или Ubuntu

image-20200729145023181

Таким образом, библиотека Pygame успешно.D:liangplanes_battlevenvScriptsОн устанавливается в среде Конечно, необходимо помнить, что проект выбирает только интерпретатор для ссылки на библиотеку Pygame.:

image-20200729145625090


Получите больше знаний, пожалуйста, нажмите Следовать:
Embedded Linux и ARM
CSDN Blog
Краткая книга блог
колонка Know

Возможно, вам также будет интересно:

  • Ошибка при установке solidworks 2013
  • Ошибка при установке punto switcher
  • Ошибка при установке social club код 1
  • Ошибка при установке postgresql не удалось запустить initdb
  • Ошибка при установке skype для бизнеса базовый 2016
  • This is not exactly a bug, it’s that there are no release wheels yet for 3.11, use pip install pygame --pre (--pre stands for pre release), it will install pygame 2.1.3.dev8 and you can use that, 2.1.3 is coming soon but I can’t tell for sure when.

    mariolacko, MaxWolf-01, wang551, rammfire, Zageron, aza547, johnp808, jeck3763, mikiweys, hit-the-dust, and 31 more reacted with thumbs up emoji
    AntonioGms2007, ghanteyyy, freebird-2, Heebeaux, Be3y4uu-K0T, mikiweys, hit-the-dust, RodionYalyna, theRealProHacker, NikBandi, and 3 more reacted with laugh emoji
    unowiz reacted with hooray emoji
    marurunk, Px228, puisigblk, LeStefan04, bikrampun, Assentencia, Kocmocy-Da, and des5771 reacted with heart emoji

    Was able to duplicate this issue with:

    • Python 3.11.0
    • macOS Monterey 12.6
    • Pygame 2.1.2
      I used pip3 install pygame and got a huge error message, as shown in the OP.

    I do have a question, if there is no wheel made for Python3 3.11.0, is installing pygame 2.1.3.dev8 the only option? Is this release stable?

    @arknaut Well, that’s the latest version of pygame that has wheels for Python 3.11 so it would be the most stable for that version of Python. Also, yeah, it should be stable enough on its own anyways, but again, it’s kind of temporary, I can’t tell for sure (or at all) but soon wheels for 2.1.3 should be released and they will be made for 3.11 too.

    @Matiiss — Okay thanks! (just clarifying) pygame 2.1.3.dev8 has been released as a temporary version of pygame so that python 3.11.0 users can continue using pygame.

    Uh, no, it’s more like 2.1.3.dev8 (it’s technically a pre-release btw) happens to have wheels for Python 3.11, it’s not specifically temporarily released for 3.11 because really 2.1.3 is kind of released already, it just doesn’t have wheels yet. But don’t take my word for it, however, I’m pretty sure it’s not something specifically done.

    2.1.3dev8 is the only version with 3.11 wheels prebuilt. If you really want to use 2.1.2, you’ll have to build the wheels yourself. But 2.1.3dev8 is essentially the full 2.1.3 release, but in pre-release form. It wasn’t specifically released to target 3.11, but since 3.11 was coming out soon, compatibility with 3.11 was added to dev8 by starbuck5 and ankith

    Are there any updates on this? Or an ETA for the new Pygame version?

    Hello everyone. I observe the same problem on Armbian

    pip install pygame
    Defaulting to user installation because normal site-packages is not writeable
    Collecting pygame
      Downloading pygame-2.1.2.tar.gz (10.1 MB)
         ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 10.1/10.1 MB 3.5 MB/s eta 0:00:00
      Preparing metadata (setup.py) ... error
      error: subprocess-exited-with-error
      
      × python setup.py egg_info did not run successfully.
      │ exit code: 1
      ╰─> [30 lines of output]
          
          
          WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
          Using UNIX configuration...
          
          /bin/sh: 1: sdl2-config: not found
          /bin/sh: 1: sdl2-config: not found
          /bin/sh: 1: sdl2-config: not found
          Traceback (most recent call last):
            File "<string>", line 2, in <module>
            File "<pip-setuptools-caller>", line 34, in <module>
            File "/tmp/pip-install-m1yp62ur/pygame_44d4c02831ed4c49940d26d640b55b6a/setup.py", line 359, in <module>
              buildconfig.config.main(AUTO_CONFIG)
            File "/tmp/pip-install-m1yp62ur/pygame_44d4c02831ed4c49940d26d640b55b6a/buildconfig/config.py", line 225, in main
              deps = CFG.main(**kwds)
            File "/tmp/pip-install-m1yp62ur/pygame_44d4c02831ed4c49940d26d640b55b6a/buildconfig/config_unix.py", line 188, in main
              DependencyProg('SDL', 'SDL_CONFIG', 'sdl2-config', '2.0', ['sdl']),
            File "/tmp/pip-install-m1yp62ur/pygame_44d4c02831ed4c49940d26d640b55b6a/buildconfig/config_unix.py", line 39, in __init__
              self.ver = config[0].strip()
          IndexError: list index out of range
          
          Hunting dependencies...
          
          ---
          For help with compilation see:
              https://www.pygame.org/wiki/Compilation
          To contribute to pygame development see:
              https://www.pygame.org/contribute.html
          ---
          
          [end of output]
      
      note: This error originates from a subprocess, and is likely not a problem with pip.
    error: metadata-generation-failed
    
    × Encountered error while generating package metadata.
    ╰─> See above for output.
    
    note: This is an issue with the package mentioned above, not pip.
    hint: See above for details.
    

    @rammfire if you read a few messages above, Matiiss gave the solution

    @rammfire if you read a few messages above, Matiiss gave the solution

    Unfortunately this is not really a solution for other packages that depend on Pygame.

    For instance, I am about to release a new version of Expyriment, which depends on Pygame, and I am currently mainly holding it back due to this issue. Would be great to have some idea on when proper Python 3.11 support is planned (roughly, like within the next few days, or will it still be months?).

    @fladd The full release of 2.1.3 is almost out. I’m hoping it’ll be within a week or two at most, but that’s really up to the discretion of the lead maintainer right now

    Cant wait for the full release ! 😄

    PeterJCLaw

    added a commit
    to PeterJCLaw/python-osc
    that referenced
    this issue

    Nov 17, 2022

    This was referenced

    Nov 17, 2022

    Though pip install pygame --pre works on python 3.11 on my windows 11. I would like to use the release version of pygame. 😄

    Looking forward to pygame-2.1.3.

    C:UsersLiu.D.H>pip install pygame --pre
    Collecting pygame
      Downloading pygame-2.1.3.dev8-cp311-cp311-win_amd64.whl (10.6 MB)
         ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 10.6/10.6 MB 4.8 MB/s eta 0:00:00
    Installing collected packages: pygame
    Successfully installed pygame-2.1.3.dev8
    
    C:UsersLiu.D.H>
    

    C:UsersLiu.D.H>pip install pygame —pre

    Can confirm this works. (Tested on Win10)

    I would advocate for a point release that basically doesn’t change anything from the previous, but simply provides wheels for the new python version. A lot of beginners will get caught up on this while a new patch release is prepared. e.g., 2.1.3 simply ships additional 3.11 wheels, 2.1.4 gets moved to new patch release.

    I would advocate for a point release that basically doesn’t change anything from the previous, but simply provides wheels for the new python version. A lot of beginners will get caught up on this while a new patch release is prepared. e.g., 2.1.3 simply ships additional 3.11 wheels, 2.1.4 gets moved to new patch release.

    To the best of my knowledge, 2.1.3 is ready for release. Just waiting on the head maintainer to actually release it.

    @fladd The full release of 2.1.3 is almost out. I’m hoping it’ll be within a week or two at most, but that’s really up to the discretion of the lead maintainer right now

    Since it has been over a month now: Is there any news regarding the release?

    Since it has been over a month now: Is there any news regarding the release?

    To the best of my knowledge, the lead maintainer has not said anything to anyone in that time. Nobody else has the ability to release 2.1.3, so unfortunately we’re stuck waiting

    @illume Python 3.11 has been out for a month and a half (and pygame’s main branch has been on 2.1.4dev1 for just as long). More and more people are starting to move to 3.11 and the fact that the only version of pygame with support for 3.11 requires knowledge of how to install a prerelease might detract users from continuing to use pygame. Is there something specific holding back the release? There are also other projects that are waiting for pygame 2.1.3 to fully release so they can update their dependencies.

    I’ve tried and tried, but can’t even instal the pre-release.
    RPi 4B, Bullseye (64-bit), Python3.11.

    pi@rxtouchlite:~/pgtest $ pip install pygame —pre
    Collecting pygame
    Downloading pygame-2.1.3.dev8.tar.gz (12.1 MB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.1/12.1 MB 2.8 MB/s eta 0:00:00
    Preparing metadata (setup.py) … error
    error: subprocess-exited-with-error

    × python setup.py egg_info did not run successfully.
    │ exit code: 1
    ╰─> [33 lines of output]

      WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
      Using UNIX configuration...
      
      /bin/sh: 1: sdl2-config: not found
      /bin/sh: 1: sdl2-config: not found
      /bin/sh: 1: sdl2-config: not found
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-9_sp3ju8/pygame_06121d1e121e4eafb99504b0ad01a83b/setup.py", line 399, in <module>
          buildconfig.config.main(AUTO_CONFIG)
        File "/tmp/pip-install-9_sp3ju8/pygame_06121d1e121e4eafb99504b0ad01a83b/buildconfig/config.py", line 231, in main
          deps = CFG.main(**kwds, auto_config=auto)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-install-9_sp3ju8/pygame_06121d1e121e4eafb99504b0ad01a83b/buildconfig/config_unix.py", line 189, in main
          DependencyProg('SDL', 'SDL_CONFIG', 'sdl2-config', '2.0', ['sdl']),
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-install-9_sp3ju8/pygame_06121d1e121e4eafb99504b0ad01a83b/buildconfig/config_unix.py", line 39, in __init__
          self.ver = config[0].strip()
                     ~~~~~~^^^
      IndexError: list index out of range
      
      Hunting dependencies...
      
      ---
      For help with compilation see:
          https://www.pygame.org/wiki/Compilation
      To contribute to pygame development see:
          https://www.pygame.org/contribute.html
      ---
      
      [end of output]
    

    note: This error originates from a subprocess, and is likely not a problem with pip.
    error: metadata-generation-failed

    × Encountered error while generating package metadata.
    ╰─> See above for output.

    note: This is an issue with the package mentioned above, not pip.
    hint: See above for details.

    Are you sure you are using the pip from python 3.11 there? Pis come with
    multiple python versions. I thought you had to use pip3 on there

    On Sat, 17 Dec 2022, 11:38 Michael Naylor, ***@***.***> wrote:
    I’ve tried and tried, but can’t even instal the pre-release.
    RPi 4B, Bullseye (64-bit), Python3.11.

    ***@***.***:~/pgtest $ pip install pygame —pre
    Collecting pygame
    Downloading pygame-2.1.3.dev8.tar.gz (12.1 MB)
    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.1/12.1 MB 2.8 MB/s eta 0:00:00
    Preparing metadata (setup.py) … error
    error: subprocess-exited-with-error

    × python setup.py egg_info did not run successfully.
    │ exit code: 1
    ╰─> [33 lines of output]

    WARNING, No «Setup» File Exists, Running «buildconfig/config.py»

    Using UNIX configuration…

    /bin/sh: 1: sdl2-config: not found

    /bin/sh: 1: sdl2-config: not found

    /bin/sh: 1: sdl2-config: not found

    Traceback (most recent call last):

    File «<string>», line 2, in <module>

    File «<pip-setuptools-caller>», line 34, in <module>

    File «/tmp/pip-install-9_sp3ju8/pygame_06121d1e121e4eafb99504b0ad01a83b/setup.py», line 399, in <module>

    buildconfig.config.main(AUTO_CONFIG)

    File «/tmp/pip-install-9_sp3ju8/pygame_06121d1e121e4eafb99504b0ad01a83b/buildconfig/config.py», line 231, in main

    deps = CFG.main(**kwds, auto_config=auto)

    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    File «/tmp/pip-install-9_sp3ju8/pygame_06121d1e121e4eafb99504b0ad01a83b/buildconfig/config_unix.py», line 189, in main

    DependencyProg(‘SDL’, ‘SDL_CONFIG’, ‘sdl2-config’, ‘2.0’, [‘sdl’]),

    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    File «/tmp/pip-install-9_sp3ju8/pygame_06121d1e121e4eafb99504b0ad01a83b/buildconfig/config_unix.py», line 39, in __init__

    self.ver = config[0].strip()

    ~~~~~~^^^

    IndexError: list index out of range

    Hunting dependencies…

    For help with compilation see:

    https://www.pygame.org/wiki/Compilation

    To contribute to pygame development see:

    https://www.pygame.org/contribute.html

    [end of output]

    note: This error originates from a subprocess, and is likely not a problem
    with pip.
    error: metadata-generation-failed

    × Encountered error while generating package metadata.
    ╰─> See above for output.

    note: This is an issue with the package mentioned above, not pip.
    hint: See above for details.


    Reply to this email directly, view it on GitHub
    <#3522 (comment)>,
    or unsubscribe
    <https://github.com/notifications/unsubscribe-auth/ADGDGGRVNWTT24EY5AYKHATWNWQ4BANCNFSM6AAAAAARQJB5DY>
    .
    You are receiving this because you commented.Message ID:
    ***@***.***>

    Are you sure you are using the pip from python 3.11 there? Pis come with multiple python versions. I thought you had to use pip3 on there

    I think so. Both ‘pip’ and ‘pip3’ report version 22.3.1 from the same ‘penv global 3.11.0’.

    Ah, I suspect it is because the pi is looking on the piwheels repository instead of PyPI and it won’t find any 3.11 wheels on piwheels because piwheels only builds wheels for a maximum of python 3.9.

    If your pip is configured to use piwheels, but you want to use PyPI instead, you can remove or comment out the extra-index-url configuration in /etc/pip.conf
    

    Otherwise you will have to learn to build pygame from source if you want to use 3.11 on a raspberry PI.

    Trinkle23897

    added a commit
    to Trinkle23897/envpool
    that referenced
    this issue

    Dec 28, 2022

    Had same error. Used temporary fix.

    Please, please, please post this solution on the homepage of Pygame!

    I’m an experienced coder but new to python and spent several hours thinking I had done something wrong.

    Unfortunately, the only person with access to the pygame.org website is the same person that can fix this whole mess in the first place. But, they’ve been unresponsive so far.

    But, they’ve been unresponsive so far.

    Bummer. First installs always seem to go sideways.

    Hello, everybody.

    I followed what was written here, but when I entered the «import pygame» command, I got an error (Windows can not find import).

    Who can help? Where is my mistake? Which direction in should I look for a solution to the problem?

    2023-02-03 161516

    2023-02-03 161438

    Did you try to run import pygame directly in command prompt? You need to be in an actual Python shell to do that (which you can get to just by typing python

    Did you try to run import pygame directly in command prompt? You need to be in an actual Python shell to do that (which you can get to just by typing python

    Thank you! This little detail helped a lot.

    I’m also trying to install from source at the moment and I’m getting the following error:

    urllib.error.HTTPError: HTTP Error 503: Egress is over the account limit.
    

    The pre-release wheel does work for me though.

    thx!

    This is not exactly a bug, it’s that there are no release wheels yet for 3.11, use pip install pygame --pre (--pre stands for pre release), it will install pygame 2.1.3.dev8 and you can use that, 2.1.3 is coming soon but I can’t tell for sure when.

    thx!

    FYI: pygame 2.1.3 had just been released with support for Python 3.11. A bit thank you to the maintainers!

    I think this can be closed.

    Nice, I updated my pygame now.

    C:UsersLiu.D.H>pip install -i https://pypi.tuna.tsinghua.edu.cn/simple -U pygame
    Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
    Requirement already satisfied: pygame in c:usersliu.d.happdatalocalprogramspythonpython311libsite-packages (2.1.3.dev8)
    Collecting pygame
      Downloading https://pypi.tuna.tsinghua.edu.cn/packages/23/c4/64a649c9c9dc649c8c01d7f1027c0656155fc48ba17e6fdd2cb38a993610/pygame-2.1.3-cp311-cp311-win_amd64.whl (10.4 MB)
         ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 10.4/10.4 MB 6.4 MB/s eta 0:00:00
    Installing collected packages: pygame
      Attempting uninstall: pygame
        Found existing installation: pygame 2.1.3.dev8
        Uninstalling pygame-2.1.3.dev8:
          Successfully uninstalled pygame-2.1.3.dev8
    Successfully installed pygame-2.1.3
    
    C:UsersLiu.D.H>

    I’m trying to install Pygame. I am running Windows 7 with Enthought Python Distribution. I successfully installed pip, but when I try to install Pygame using pip, I get the following error:

    «Could not install requirement Pygame because of HTTP error HTTP error
    400: Bad request for URL …»

    I can’t find anything about this issue with a Google search, but I did find another Stack Overflow question that prompted the asker to use the following command:

    pip install hg+http://bitbucket.org/pygame/pygame
    

    This gave me the following error:

    Cannot find command hg
    

    I’m not sure what else to do, as everything I find with a Google search is for Mac, so I don’t know how well I can follow those instructions on Windows.

    jchanger

    7399 silver badges29 bronze badges

    asked Jul 25, 2013 at 21:31

    NumberOneRobotNumberOneRobot

    1,6516 gold badges17 silver badges23 bronze badges

    6

    Steps to install PyGame using pip

    1. Install build dependencies (on linux):

      sudo apt-get build-dep python-pygame
      
    2. Install mercurial to use hg (on linux):

      sudo apt-get install mercurial
      

      On Windows you can use the installer: Download

    3. Use pip to install PyGame:

      pip install hg+http://bitbucket.org/pygame/pygame
      

      If the above gives freetype-config: not found error (on Linux), then try sudo apt-get install libfreetype6-dev and then repeat 3.

    Alternative way:

    # Grab source
    hg clone https://bitbucket.org/pygame/pygame
    
    # Finally build and install
    cd pygame
    python setup.py build
    sudo python setup.py install
    

    8

    Try doing this:

    sudo apt-get install mercurial
    sudo pip install hg+http://bitbucket.org/pygame/pygame
    

    answered Jun 18, 2014 at 6:31

    An update to this may be required, as it stands in version 1.9.1 it should simply install using:

    pip install pygame

    However, it look like there is a bug with their pypi repository, see:
    https://bitbucket.org/pygame/pygame/issues/59/pygame-has-no-pypi-page-and-cant-be

    So, if you want the most recent release, you have to point directly at the ftp file ala:

    pip install http://www.pygame.org/ftp/pygame-1.9.1release.tar.gz

    I suppose this will be fixed in the 1.9.2 release but for now this works.

    I would note that the answer supplied by Pratyush works as well, but requires the user to install mercurial if they don’t have it and downloads the trunk version, so really, not ideal unless you absolutely need it.

    answered Dec 24, 2015 at 0:56

    Caveat: I’m not familiar with the Enthought Distribution, so this might not help.

    As you’re trying to install on Windows, if you don’t want to have to mess around with C compilers, there are pre-built binary wheels for pygame here: http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame

    Select a package appropriate to you python version[0] and Windows architecture [1]. Download to C:UsersUserDownloadpip install E:envpygame-1.9.2a0-cp27-none-win_amd64.whl and install with pip install E:envpygame-1.9.2a0-cp27-none-win_amd64.whl

    Mercurial binaries can be found on the same page, if you would like to install from source. This method would mean compiling pygame from source, for which you probably want to use this compiler package.

    [0] python --version

    [1] powershell "gwmi win32_operatingsystem | select osarchitecture"

    answered Jan 21, 2015 at 21:57

    laffoyblaffoyb

    1,5403 gold badges22 silver badges35 bronze badges

    3

    The command below worked for me on Mac OS X El Capitan:

    pip3 install pygame

    voices

    4956 silver badges20 bronze badges

    answered Sep 8, 2016 at 12:58

    ZekeZeke

    1341 silver badge4 bronze badges

    Install on MAC:

    brew install homebrew/python/pygame
    

    answered May 29, 2016 at 15:44

    Nizar B.Nizar B.

    3,0789 gold badges38 silver badges56 bronze badges

    1

    Just

    sudo pip install pygame
    

    worked for me

    answered Nov 13, 2016 at 21:30

    Had this issue on macOS Sierra, where apt-get doesn’t work.

    Managed to solve the issue through the following steps:

    First I had to install the Mercurial via Brew:

    brew install mercurial
    

    Then, I had to install Pygame dependencies:

    brew install sdl sdl_image sdl_mixer sdl_ttf smpeg portmidi
    

    Finally I used pip3 to install Pygame:

    pip3 install pygame
    

    Hope this helps!

    answered May 5, 2017 at 10:39

    daveliewdaveliew

    752 silver badges7 bronze badges

    Try

    python3 -m pip install -U pygame --user
    

    This worked twice for me on windows 7 and windows 10

    answered Mar 8, 2018 at 20:14

    The most current, the best way to install pygame is always available at:
    https://www.pygame.org/wiki/GettingStarted

    How to use pip depends on the operating system. So unless you have always updated and tested answers for 15 different operating systems then just send people to that page. All answers to this question are wrong for various different operating systems.

    Currently, for windows, this is the way to install it in the cmd prompt. (If you already have pip installed, and people know what pip is… best just send people to the GettingStarted page).

    py -m pip install pygame --user

    answered Feb 6, 2018 at 19:00

    I did use these instructions here from the official site.
    But i had to change the python3 part of the command to just py.

    answered Feb 8, 2018 at 14:55

    BjamseBjamse

    3335 silver badges17 bronze badges

    Try: python -m pip install pygame

    Or: py -m pip install pygame

    answered Nov 17, 2018 at 19:54

    ArmsterArmster

    7421 gold badge9 silver badges25 bronze badges

    Try pip install pygame or pip3 install pygame.

    These should work for you.

    If this does not work for you put -m before pip and python before
    -m.

    If putting -m does not work try reinstalling python

    answered Jun 16, 2020 at 21:26

    If you are working on windows, the command below should work fine

     pip install pygame
    

    If you are working on Linux, the command below should work fine

    sudo apt-get install python-pygame
    

    answered Jul 24, 2020 at 15:56

    Type this in command prompt

    pip install pygame

    or

    py -m pip install pygame

    answered Nov 10, 2020 at 12:30

    WINDOWS

    If you are on a windows 10 device then you should use this command but first make sure you have Python installed from https://python.org, if you do run this in command prompt

    py --version
    

    and then whatever version it says you have (which you downloaded) keep it in mind we will use it later for now just incase try to upgrade pip incase you are on a outdated version I will be using 3.9 for the version for the rest of this as an example

    py -3.9 -m pip --upgrade pip
    

    After that if you have it already satisfied or it upgraded run this command in command prompt

    py -3.9 -m pip install pygame
    

    And wait for it to download
    And to make sure it worked run this

    py -3.9 -m pygame --version
    

    If it shows the version you downloaded it!

    MacOS

    For MacOS do the same but then run this command to install it

    python3 -m pip install -U pygame --user
    

    or if it wont work

    py -3.9 -m pip install -U pygame --user      ( or just pip3 )
    

    to see if it worked run this

    python3 -m pygame.examples.aliens
    

    or

    py -3.9 -m pygame.examples.aliens
    

    I hope this helped

    answered Nov 12, 2021 at 21:51

    I have never used Enthought distribution, but you could try to use Anaconda distribution which is also great too.

    Anaconda Distribution (Any OS):

    From the docs:

    Update conda to the current version.
    Type the following:

    conda update conda
    

    If a newer version of conda is available, type y to update:
    Proceed ([y]/n)? y

    Check to see if a package you have not installed named
    “pygame” is available from the Anaconda repository (must be
    connected to the Internet):

    conda search pygame
    

    Conda displays a list of all packages with
    that name on the Anaconda repository, so we know it is available.

    Install this package into the current environment:

    conda install pygame
    

    Check to see if the newly installed
    program is in this environment:

    conda list
    

    Install on Windows (both python 2.7 and 3.7):

    pip install pygame 
    

    Install on raspberry pi:

    sudo pip3 install pygame (python 3.7)
    sudo pip install pygame (python 2.7)
    

    answered Aug 7, 2018 at 7:45

    I think if you go to Command Prompt and type

    py -m pip install pygame
    

    that’s what works for me

    answered Nov 17, 2018 at 22:48

    Here is a way: sudo install pygame Rasberry pi has it ready-installed

    answered Jul 4, 2020 at 12:39

    1

    Install python 3.8 from python.org
    Then install pygame (2.0) like this
    pip install pygame==2.0.0.dev10

    answered Aug 3, 2020 at 13:59

    PythonProgrammiPythonProgrammi

    22.2k3 gold badges40 silver badges34 bronze badges

    Make sure script path is registered in environment variables,
    Make sure the python path is registered in environment variables,
    also you dont have to enter entire url just write like this(windows only I dont use mac)

    pip
    pip install pygame
    

    hope it work

    answered Aug 26, 2021 at 12:15

    1

    command to install pygame is:

    pip install pygame
    

    run it in command prompt

    answered Feb 24, 2022 at 8:02

    Try doing this for python3:

    python3 -m pip install pygame==1.9.6
    

    and this for python2:

    python -m pip install pygame==1.9.6
    

    answered Jun 28, 2020 at 15:49

    WinstonManWinstonMan

    1221 silver badge13 bronze badges

    You don’t have to type in the entire url. Just simply go to command prompt (windows) or terminal (mac) and then type in:

    [windows] pip install pygame
    [mac] python -m install pygame

    hopefully that works

    answered Apr 25, 2021 at 6:18

    To install pygame with pip, use the following commands in the Command Prompt on Windows.

    py -m pip download pygame
    

    then…

    py -m pip install pygame
    

    You only have to do the download pygame one if it doesn’t work when you use the install pygame command by itself.

    You type py -m to show that it is using the module pip, which can be accessed through the command prompt.

    This is for Windows. For Mac OS, use python -m pip install pygame

    answered Apr 1, 2021 at 10:27

    1

    I know that there are already lot’s of answers, but if you want to download a specific version of pygame, you can use pip:

    pip install pygame==1.9.6
    

    Pygame 1.9.6 is the latest version at the time of writing.

    answered Sep 12, 2021 at 1:19

    theProCodertheProCoder

    3486 silver badges21 bronze badges

    Pygame tells you how to install it here, in my personal experience this is what I do on windows to install it, open up command prompt and type python -m pip install pygame if that fails, check if you have more than one version of python installed if so you need to specify what version for example python3.5 -m pip install pygame the reason we do this from command prompt is that in the Python shell it doesn’t understand what pip install is just to break it down a little python -m calls a python module in this case we want pip the next two arguments are what we want pip to do and what module/addon we want the action to be applied too

    answered Oct 19, 2022 at 17:38

    2

    First you have to run command prompt in administrator mode. To run in administrator mode:

    1. Type command prompt in Windows search bar.
    2. Right click on the command prompt option and click ‘Run as administrator’.
    3. Windows will ask you if you want to allow the app to make changes to your device. Click ‘Yes’.
    4. Command prompt will open in administrator mode.

    Then type the following:

    pip3 install pygame
    

    answered Mar 21 at 9:48

    DinuxDinux

    3651 gold badge2 silver badges14 bronze badges

    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!

    Collecting pygame
      Using cached pygame-2.1.2.tar.gz (10.1 MB)
      Preparing metadata (setup.py) ... error
      error: subprocess-exited-with-error
     
      × python setup.py egg_info did not run successfully.
      │ exit code: 1
      ╰─> [32 lines of output]
          
          
          WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
          Using UNIX configuration...
          
          /bin/sh: pkg-config: not found
          /bin/sh: pkg-config: not found
          /bin/sh: pkg-config: not found
          Traceback (most recent call last):
            File "<string>", line 2, in <module>
            File "<pip-setuptools-caller>", line 34, in <module>
            File "/tmp/pip-install-4ux7mnm0/pygame_105c4eeb0de54659b8330f75d435adf2/setup.py", line 359, in <module>
              buildconfig.config.main(AUTO_CONFIG)
            File "/tmp/pip-install-4ux7mnm0/pygame_105c4eeb0de54659b8330f75d435adf2/buildconfig/config.py", line 225, in main
              deps = CFG.main(**kwds)
            File "/tmp/pip-install-4ux7mnm0/pygame_105c4eeb0de54659b8330f75d435adf2/buildconfig/config_unix.py", line 208, in main
              DEPS.append(find_freetype())
            File "/tmp/pip-install-4ux7mnm0/pygame_105c4eeb0de54659b8330f75d435adf2/buildconfig/config_unix.py", line 172, in find_freetype
              pkg_config = DependencyProg(
            File "/tmp/pip-install-4ux7mnm0/pygame_105c4eeb0de54659b8330f75d435adf2/buildconfig/config_unix.py", line 39, in __init__
              self.ver = config[0].strip()
          IndexError: list index out of range
          Hunting dependencies...
          ---
          For help with compilation see:
              https://www.pygame.org/wiki/Compilation
          To contribute to pygame development see:
              https://www.pygame.org/contribute.html
          ---
          [end of output]
      note: This error originates from a subprocess, and is likely not a problem with pip.
    error: metadata-generation-failed
    × Encountered error while generating package metadata.
    ╰─> See above for output.
    note: This is an issue with the package mentioned above, not pip.
    hint: See above for details.

    Понравилась статья? Поделить с друзьями:
    0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии
  • Oracle password file windows
  • Как узнать параметры материнской платы в windows 10
  • Репликация dfs windows server 2016
  • Локальный отладчик windows visual studio
  • Команды на компьютере с помощью клавиатуры windows 10