1.首先使用如下命令:
conda install -c https://conda.anaconda.org/quasiben pygame
测试报错:
>>> import pygame Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/matrix/anaconda3/envs/py2/lib/python2.7/site-packages/pygame/__init__.py", line 127, in <module> from pygame.base import * ImportError: dlopen(/Users/matrix/anaconda3/envs/py2/lib/python2.7/site-packages/pygame/base.so, 2): Library not loaded: /usr/local/lib/libSDL-1.2.0.dylib Referenced from: /Users/matrix/anaconda3/envs/py2/lib/python2.7/site-packages/pygame/base.so Reason: image not found
Solution:
1.卸载:
conda uninstall pygame
2.重新用pip安装:
python -m pip install pygame