在 ubuntu 20.04LTS 上安装 pygame 的问题 [英] Problem to install pygame on ubuntu 20.04LTS

查看:50
本文介绍了在 ubuntu 20.04LTS 上安装 pygame 的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Ubuntu 20.04LTS,我尝试为学校项目安装 pygame(用于 Python).但是当我尝试这个时:

I am on Ubuntu 20.04LTS, and I try to install pygame (for python) for a school project. But when I try this:

sudo pip3 install pygame

我收到一个错误:

ERROR: Command errored out with exit status 1:
 command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-szdn6q_u/pygame/setup.py'"'"'; __file__='"'"'/tmp/pip-install-szdn6q_u/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-3fqnujta
     cwd: /tmp/pip-install-szdn6q_u/pygame/
Complete output (18 lines):


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


Hunting dependencies...
SDL     : found 1.2.15
FONT    : not found
IMAGE   : not found
MIXER   : not found
PNG     : found
JPEG    : found
SCRAP   : found
PORTMIDI: not found
PORTTIME: not found
FREETYPE: found 23.1.17
Missing dependencies
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

你能帮我吗?

推荐答案

尝试安装

sudo apt install python3-pygame

相反.您收到的错误是因为您缺少 apt 应该为您安装的 Pygame 依赖项.

instead. The error you are getting is because you are missing the Pygame dependencies, which apt should install for you.

作为一般规则,最好通过包管理器安装 Python 包,只有在它们不可用时才使用 pip.

As a general rule, it’s a good idea to install Python packages through the package manager, and use pip only if they’re unavailable unavailable.

这篇关于在 ubuntu 20.04LTS 上安装 pygame 的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆