python - 无法安装pygame
问题描述
我试图通过使用命令来安装 python-packages pip3 install pygame
。我在 Ubuntu(linux) 上,这就是我使用pip3
而不是pip
. 但它返回以下错误
Collecting pygame
Using cached pygame-1.9.6.tar.gz (3.2 MB)
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-e71p_fru/pygame/setup.py'"'"'; __file__='"'"'/tmp/pip-install-e71p_fru/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-install-e71p_fru/pygame/pip-egg-info
cwd: /tmp/pip-install-e71p_fru/pygame/
Complete output (29 lines):
WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using UNIX configuration...
/bin/sh: 1: sdl-config: not found
/bin/sh: 1: sdl-config: not found
/bin/sh: 1: sdl-config: not 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
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
/bin/sh: 1: freetype-config: not found
/bin/sh: 1: freetype-config: not found
/bin/sh: 1: freetype-config: not found
Hunting dependencies...
WARNING: "sdl-config" failed!
WARNING: "pkg-config freetype2" failed!
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.
此外,除了 pygame 之外的任何软件包都不会发生这种情况。
我正在使用 python3.8,我在 Ubuntu20.04
任何帮助,将不胜感激!
解决方案
许多 Linux 发行版都有自己的 Pygame 包
安装到 Ubuntu/Debian/Mint;
sudo apt-get install python3-pygame
安装到 Fedora/Red hat;
sudo yum install python3-pygame
推荐阅读
- spring-boot - Spring kafka 重试回调不起作用
- python - 可视化倾斜数据
- android - 是否可以以编程方式启用或禁用 Android 相机中的地理标记功能
- ios - 使用带有 mac 催化剂的撤消管理器
- c++ - c ++中的stringstream有助于从字符串中提取逗号分隔的整数,但不能使用向量提取空格分隔的整数,为什么?
- jenkins - 在 Jenkinsfile 中使用 groovy 更新 semver 之后的版本
- powerpoint - 选择部分缩放矩形而不单击(powerpoint)
- css - post-css 找不到来自 node_modules 的路径
- powershell - 使用 Powershell 通过 IE 使用 JavaScript 时的空文档
- php - liip_imagine [在 Sylius 内] 不在 linux 上缓存图像