我在我的macbook pro上运行mac osx siera,我试图在我的python安装中安装pygame。我尝试过几次安装它,但是当我尝试检查它或测试它时,pygame似乎并不存在。如果有人可以请让我知道如何做到这一点或我做错了什么我真的很感激。
Code:
## Checking python version
Macbook-Pro:~ myname$ python
Python 2.7.13 |Anaconda custom (x86_64)| (default, Dec 20 2016, 23:05:08)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org
## Checking for pygame
Macbook-Pro:~ myname$ conda search pygame
Fetching package metadata ...........
PackageNotFoundError: Packages missing in current channels:
- pygame
We have searched for the packages in the following channels:
- https://conda.anaconda.org/anaconda-fusion/osx-64
- https://conda.anaconda.org/anaconda-fusion/noarch
- https://repo.continuum.io/pkgs/free/osx-64
- https://repo.continuum.io/pkgs/free/noarch
- https://repo.continuum.io/pkgs/r/osx-64
- https://repo.continuum.io/pkgs/r/noarch
- https://repo.continuum.io/pkgs/pro/osx-64
- https://repo.continuum.io/pkgs/pro/noarch
## Installing pygame
Macbook-Pro:~ myname$ conda install -c https://conda.anaconda.org/quasiben pygame
Fetching package metadata .............
Solving package specifications: .
Package plan for installation in environment /Users/myname/anaconda:
The following NEW packages will be INSTALLED:
pygame: 1.9.1-py27_1 quasiben
Proceed ([y]/n)? y
## Testing
Macbook-Pro:~ myname$ python -m pygame.examples.aliens
/Users/myname/anaconda/bin/python: dlopen(/Users/myname/anaconda/lib/python2.7/site-packages/pygame/base.so, 2): Library not loaded: /usr/local/lib/libSDL-1.2.0.dylib
Referenced from: /Users/myname/anaconda/lib/python2.7/site-packages/pygame/base.so
Reason: image not found
Macbook-Pro:~ myname$
## uninstall and re-install
Macbook-Pro:~ myname$ conda uninstall pygame
Fetching package metadata ...........
Solving package specifications: .
Package plan for package removal in environment /Users/myname/anaconda:
The following packages will be REMOVED:
pygame: 1.9.1-py27_1 quasiben
Proceed ([y]/n)? y
## Trying to install a new way
Macbook-Pro:~ myname$ conda install -c kne pygame=1.9.2a0
Fetching package metadata .............
Solving package specifications: .
Package plan for installation in environment /Users/myname/anaconda:
The following NEW packages will be INSTALLED:
pygame: 1.9.2a0-py27_0 kne
Proceed ([y]/n)? y
Macbook-Pro:~ myname$ python -m pygame.examples.aliens
/Users/myname/anaconda/bin/python: dlopen(/Users/myname/anaconda/lib/python2.7/site-packages/pygame/base.so, 2): Library not loaded: /usr/local/opt/sdl/lib/libSDL-1.2.0.dylib
Referenced from: /Users/myname/anaconda/lib/python2.7/site-packages/pygame/base.so
Reason: image not found
Macbook-Pro:~ myname$