ubuntu16.04上安装Python 3.5.X的pygame

  1. 安装依赖

    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
    
  2. 用Mercurial下载pygame源码 (下了十几分钟,国内网渣渣!)

    hg clone https://bitbucket.org/pygame/pygame
    
  3. 编译和安装pygame

    cd pygame
    python3 setup.py build
    sudo python3 setup.py install
    
  4. 检查是否安装好

    python3 -c "import pygame"
    

也可运行python3后输入

 import pygame

什么都没输出就证明安装pygame成功!

原文来自http://askubuntu.com/questions/708248/cannot-install-pygame-for-python-3-5-1

你可能感兴趣的:(ubuntu16.04上安装Python 3.5.X的pygame)