一》linux安装pygame,报错:mixer not found
解决办法:安装mixer的dependencies
1》sudo apt install python3.5-dev mercurial libsdl-image1.2-dev libsdl2-dev libsdl-ttf2.0-dev
2》sudo apt install libsdl-mixer1.2-dev libportmidi-dev libswscale-dev libsmpeg-dev libavformat-dev libavcodec-dev
3》sudo apt install python-nump
后,mixer问题解决,
安装,pygame:
sudo pip3 install pygame
二》报错freetype not found,missing
pip版本降级:我装的是最新20版本,有网友推荐降级
查看当前版本,显示是20
pip --version
版本降到19
python3 -m pip install pip==19.1.1
然后,安装freetype依赖
sudo apt-get -y install libfreetype6-dev
继续装pygame
sudo pip3 install pygame
验证是否成功:
python3 -m pygame.examples.aliens
游戏出现,验证成功。