开发者

Where can I find and install the dependencies for pygame?

开发者 https://www.devze.com 2023-04-10 09:50 出处:网络
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

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.

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 so开发者_开发知识库me guidance I would appreciate it.

Thank you.


$ 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

Or sorted slightly:

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


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

apt-get build-dep python-pygame

Installs all the dependences required to build pygame :)

On Fedora:

yum-builddep package_name


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


this steps work for me on 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


My list for Arch Linux:

sudo pacman -Sy sdl_ttf sdl_sound sdl_image sdl_mixer portmidi


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

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


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

Here is a one line solution that worked for me with python version 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


I (debian buster, python2) recently tried to update pygame from 1.9.4 to 2.0.2, and it seems there has been a switch to newer dependencies compared to the other answers given here, for example from libsdl1.2-dev to libsdl2-dev.

This is what i needed to install for pip2 install --upgrade pygame to go through without error:

sudo apt install libsdl2-dev libsdl2-ttf-dev libsdl2-image-dev libsdl2-mixer-dev libportmidi-dev


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

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:

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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号