pygame的安装:
1、安装
在termina中直接输入下面命令就能安装好了:
pip install pygame
2、遇到的问题
出现问题:Distributed 1.21.8 requires msgpack, which is not installed
解决:
First Method: Run this command:
conda install -c anaconda msgpack-python
Second Method: Run this command:
pip install msgpack
在次执行上面的命令出现:grin 1.2.1 requires argparse>=1.1, which is not installed.
解决:
pip install argparse
3、最后执行操作
在执行pip install pygame 就可以了。
4、如果是python3 , 并且是使用anaconda, 执行下面命令:
anaconda search -t conda pygame
For Python 3 use the following:
conda install -c https://conda.binstar.org/kne pygame
conda create -n pygameenv -c cogsci pygame
5、(本人使用就是这个方案)如果上面的方法还是不行的话, 可以直接到conda 的环境下面找对应的Python 版本进行操作, 具体如图1所示:
在py36 的bin 目录下面执行命令:
/xxx/xxx/envs/py36/bin/pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pygame
其中/xxx/xxx是 本人自己安装conda 的目录,-i 后面的参数,表示的是使用清华大学的国内镜像下载, 如果安装过程中出现如下错误:
You are using pip version 10.0.1, however version 18.0 is available.
You should consider upgrading via the ‘pip install –upgrade pip’ command.
就在当前的目录下面执命令:./pip install –upgrade pip
在执行命令:
/xxx/xxx/envs/py36/bin/pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pygame
就可以安装成功了。
https://stackoverflow.com/questions/48972603/installing-pygame-for-python3-in-mac-using-anaconda