1
votes

so I am doing a python project where I have to make a click and drag portion. So I am using pygame. So far, I tried doing pip install pygame, and sudo apt install pygame, but I get the following error.

ERROR: Command errored out with exit status 1: command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-b36hmuvw/pygame/setup.py'"'"'; file='"'"'/tmp/pip-install-b36hmuvw/pygame/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-l96tsf_2 cwd: /tmp/pip-install-b36hmuvw/pygame/ Complete output (29 lines):

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 1, in <module>
  File "/tmp/pip-install-b36hmuvw/pygame/setup.py", line 318, in <module>
    buildconfig.config.main(AUTO_CONFIG)
  File "/tmp/pip-install-b36hmuvw/pygame/buildconfig/config.py", line 221, in main
    deps = CFG.main(**kwds)
  File "/tmp/pip-install-b36hmuvw/pygame/buildconfig/config_unix.py", line 194, in main
    DependencyProg('SDL', 'SDL_CONFIG', 'sdl2-config', '2.0', ['sdl']),
  File "/tmp/pip-install-b36hmuvw/pygame/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
---

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

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

I am new to python and don't know how to fix this issue.

1
you may have to install C/C++ library libsdl using apt OR maybe newer version libsdl2 with SDL 2.0furas

1 Answers

1
votes

you can install it with "sudo apt install python-pygame" but if you open "python3.7", "python2.7" etc. and type in "import pygame" this comes out:

SyntaxError: invalid syntax
>>> import pygame
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pygame'

but if you open python from terminal with the command "python" the command "import pygame" works ,but all other things you installed with pip doesn't work. I hope i helped you :D

With friendly regards Kolpix