python - 尝试在 ubuntu 上安装 pygame 会出错
问题描述
我正在尝试使用 pip 安装 pygame 但每当我这样做时都会收到错误消息Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-hZGMxh/pygame/
。在我访问过的网站上,谷歌搜索它所说的更新 setuptools 的错误。我这样做了,但它告诉我我已经有了最新版本。以下是我尝试安装它时收到的错误。我需要使用它,HyperGAN
所以我无法安装python3-pygame
,因为它没有作为 pygame 安装,所以我没有安装名为“pygame”的模块。非常感谢。
dan@dan-VirtualBox:/home$ python -m pip install pygame
Collecting pygame
Using cached https://files.pythonhosted.org/packages/ea/00/c8c0432a84fce4061fc9799747ea205805e247c559db1b71ac9f768e38e0/pygame-1.9.4.post1.tar.gz
Complete output from command python setup.py egg_info:
WARNING, No "Setup" File Exists, Running "config.py"
Using UNIX configuration...
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
sh: 1: freetype-config: not found
sh: 1: freetype-config: not found
sh: 1: freetype-config: not found
Hunting dependencies...
WARNING: "pkg-config freetype2" failed!
WARNING: "freetype-config" failed!
SDL : found 1.2.15
FONT : found
IMAGE : found
MIXER : found
PNG : found
JPEG : found
SCRAP : found
PORTMIDI: found
PORTTIME: found
FREETYPE: not found
Missing dependencies
----------------------------------------
命令“python setup.py egg_info”在 /tmp/pip-build-hZGMxh/pygame/ 中失败,错误代码为 1
解决方案
最新的 pygame 没有所有的二进制包(又名轮子)。尝试安装旧的。
% pip install pygame==1.9.4
或者按照缺少的依赖项安装它们。
% sudo apt install libfreetype6-dev
祝你好运!
推荐阅读
- python-3.x - 将数据框列名复制到新行
- linux - 比较 shell/bash 脚本中的两个日期并找出天差
- string - Firestore 获取包含字符串的文档
- sql - SQL JSON NULL 值
- mysql - MariaDB 10.4 随机性能下降
- javascript - 如何以无损方式缩短文本
- python - 为什么“with open(file.txt)”语句的第二行在python中返回一个空字符串?
- java - 如何使用 Jackson 从 Json 文件中删除文本节点
- android - 是否可以在颤动中更改谷歌地图的默认语言?
- html - 如何让Material-UI的对话框变成图片的形状