2014年4月16日 星期三

安裝pygame on ubuntu12.04

pygame是python的第三方程式庫

1.相依性安裝
sudo apt-get install python3-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev libsmpeg-dev python-numpy libportmidi-dev ffmpeg libswscale-dev libavformat-dev libavcodec-dev checkinstall mercurial

2.下載pygame
hg clone https://bitbucket.org/pygame/pygame

3.變更至該目錄
cd pygame

4.編譯
python3 setup.py build

5.安裝
sudo checkinstall python3 setup.py install


資料摘取自網路



Installation
Start by installing all necessary dependencies, and mercurial and checkinstall for the installation:
1sudo apt-get install python3-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev libsmpeg-dev python-numpy libportmidi-dev ffmpeg libswscale-dev libavformat-dev libavcodec-dev checkinstall mercurial
Then download the latest version of the Pygame source code with the following command (this uses mercurial):
Go into the downloaded Pygame directory:
1cd pygame
Compile the source code by typing this command into the terminal:
1python3 setup.py build
Finally install Pygame by doing this:
1sudo checkinstall python3 setup.py install
Extra stuff
Click here to read why you should use checkinstall.
Use this command to see information about your pygame installation:
1apt-get cache show pygame
And this command to uninstall Pygame:
1dpkg -r pygame
or:
1sudo apt-get remove pygame
Notes
The most recent stable pygame version when writing this is 1.9.1 (which is from August 2009). I did this installation on Ubuntu 12.04 and this was needed since there isn’t a python3-pygame available in the repository.

0 意見: