【发布时间】:2021-04-04 06:35:19
【问题描述】:
所以我正在做一个 python 项目,我必须点击并拖动部分。所以我正在使用pygame。到目前为止,我尝试执行 pip install pygame 和 sudo apt install pygame,但出现以下错误。
错误:命令出错,退出状态为 1: 命令:/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/ 完整输出(29 行):
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
---
----------------------------------------
错误:命令出错,退出状态为 1:python setup.py egg_info 检查日志以获取完整的命令输出。
我是 python 新手,不知道如何解决这个问题。
【问题讨论】:
-
您可能需要安装 C/C++ 库
libsdl使用apt或者可能是更新版本的libsdl2和SDL 2.0