-
安装依赖
sudo apt-get install mercurial python3-dev python3-numpy libav-tools \ libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsmpeg-dev \ libsdl1.2-dev libportmidi-dev libswscale-dev libavformat-dev libavcodec-dev
-
用Mercurial下载pygame源码 (下了十几分钟,国内网渣渣!)
hg clone https://bitbucket.org/pygame/pygame
-
编译和安装pygame
cd pygame python3 setup.py build sudo python3 setup.py install
-
检查是否安装好
python3 -c "import pygame"
也可运行python3后输入
import pygame
什么都没输出就证明安装pygame成功!
原文来自http://askubuntu.com/questions/708248/cannot-install-pygame-for-python-3-5-1