在Ubuntu上安装Pygame的问题20.04LTS

发布于 2025-02-13 17:11:45 字数 1189 浏览 3 评论 0原文

我在Ubuntu 20.04lts上,然后尝试安装Pygame(用于Python)进行学校项目。但是,当我尝试一下时:

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.

请帮助我吗?

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

I received an error:

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.

Can you help me, please?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

凉世弥音 2025-02-20 17:11:45

尝试使用它安装

sudo apt install python3-pygame

。您遇到的错误是因为您缺少Pygame依赖关系,因此APT应该为您安装。

通常,通过软件包管理器安装Python软件包是一个好主意,并且只有在那里不可用时才使用PIP。

Try installing it with

sudo apt install python3-pygame

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

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 there.

酸甜透明夹心 2025-02-20 17:11:45

尝试这样的安装:

python3 -m pip install pygame == 1.9.5rc2

我遇到了同样的问题,而且效果很好。

Try install like this:

python3 -m pip install pygame==1.9.5rc2

I was having same problem and it worked very well.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文