Linux 在哪里可以找到并安装 pygame 的依赖项?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7652385/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-05 06:29:56  来源:igfitidea点击:

Where can I find and install the dependencies for pygame?

pythonlinuxdebianpygame

提问by Andy

I am relatively new to linux and am trying to install the pygame dev environment for python. When I run the setup.py it says that I need to install the following dependencies, one of which I found and installed (SDL). However, the others have been more elusive.

我对 linux 比较陌生,正在尝试为 python 安装 pygame dev 环境。当我运行 setup.py 时,它说我需要安装以下依赖项,我找到并安装了其中之一(SDL)。然而,其他人更加难以捉摸。

Hunting dependencies...
sh: smpeg-config: command not found
WARNING: "smpeg-config" failed!
SDL     : found 1.2.14
FONT    : not found
IMAGE   : not found
MIXER   : not found
SMPEG   : not found
PNG     : not found
JPEG    : not found
SCRAP   : found
PORTMIDI: not found
PORTTIME: not found

If you could give me some guidance I would appreciate it.

如果您能给我一些指导,我将不胜感激。

Thank you.

谢谢你。

采纳答案by Constantinius

For debian, there is a pre-built package available. See here. You should be able to install it with apt-getor something similar.

对于 debian,有一个可用的预构建包。见这里。您应该能够安装它apt-get或类似的东西。

回答by 9000

If you run one of supported Linux distributions (see "Unix Distributions" section), you just install pygame from a repository, and dependencies are installed, too.

如果您运行受支持的 Linux 发行版之一(请参阅“Unix 发行版”部分),您只需从存储库安装 pygame,并且也安装了依赖项。

Generally, you need SDL (libsdl and friends), Python, Numpy.

一般来说,你需要 SDL(libsdl 和朋友)、Python、Numpy。

回答by kiranmathewkoshy

$ sudo apt-get install python-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev libsmpeg-dev python-numpy subversion libportmidi-dev ffmpeg libswscale-dev libavformat-dev libavcodec-dev

$ sudo apt-get install python-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev libsmpeg-dev python-numpy subversion libportmidi-dev ffmpeg libswscale-dev libavformat-dev libavcodec-dev

回答by GuySoft

Behold, one of the most useful tools on debian-based dsitros:

看哪,基于 debian 的 dsitro 上最有用的工具之一:

apt-get build-dep python-pygame

Installs all the dependences required to build pygame :)

安装构建 pygame 所需的所有依赖项 :)

On Fedora:

在 Fedora 上:

yum-builddep package_name

回答by Peter Teoh

Mine is Fedora-20, and I found this worked:

我的是 Fedora-20,我发现这有效:

sudo yum install python-opengl
sudo yum install python-devel SDL_image-devel SDL_mixer-devel SDL_ttf-devel SDL-devel smpeg-devel numpy subversion portmidi-devel 

Downloaded the smpeg from the website:

从网站下载了 smpeg:

http://freecode.com/projects/smpeg

http://freecode.com/projects/smpeg

and did a local install:

并进行了本地安装:

sudo yum localinstall smpeg-0.4.5-2.1.x86_64.rpm 
sudo yum install pygame pygame-devel

回答by aldajo92

this steps work for me on Ubuntu 16.04:

这些步骤在 Ubuntu 16.04 上对我有用:

$ sudo apt-get install python-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev   libsdl1.2-dev libsmpeg-dev python-numpy subversion libportmidi-dev ffmpeg libswscale-dev libavformat-dev libavcodec-dev

$ sudo pip3 install pygame

回答by robocelot

on ubuntu 20.04 as of this date I had the SDL missing error and found a solution only to run into a freetype error then had to reinstall because the --user option in the python3 pip command kept me from accessing the module

截至目前,在 ubuntu 20.04 上,我遇到了 SDL 丢失错误并找到了一个解决方案,但结果却遇到了 freetype 错误,然后不得不重新安装,因为 python3 pip 命令中的 --user 选项使我无法访问该模块

Here is a one line solution that worked for me with python version 3.8.2:

这是一个单行解决方案,适用于 python 版本 3.8.2:

sudo apt-get install python-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev libsmpeg-dev python-numpy subversion libportmidi-dev ffmpeg libswscale-dev libavformat-dev libavcodec-dev install libfreetype6-dev && python3 pip -m install -u pygame