Mac安装pygame 遇到的所有问题

  1. 安装homebrew,通过homebrew来安装python和pip
  2. 通过pip3 install Pygame. 到这里会报错为:
    pip3 install pygame

Collecting pygame
Could not find a version that satisfies the requirement pygame (from versions: )
No matching distribution found for pygame

解决方法一:更改镜像服务器:
pip3 install Pygame -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

到这里会报错如下:Mac安装pygame 遇到的所有问题

此时做如下命令:
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

执行成功后会如下所示:
installer: Package name is macOS_SDK_headers_for_macOS_10.14
installer: Installing at base path /
installer: The install was successful.

解决这个问题以后,重新执行pygame的命令,成功。
Installing collected packages: Pygame
Running setup.py install for Pygame
Successfully installed Pygame-1.9.6
huhaipingdeMacBook-Pro:~ huhaiping$