使用自制软件安装 pygame

Sai*_*ait 3 python homebrew pygame

我正在尝试使用 Homebrew 为 Python3 安装 pygame。(我的机器上有 Python 2 和 Python 3。)

我使用了这个 Reddit 页面,它说:

brew tap Homebrew/python
brew update
brew install pygame
Run Code Online (Sandbox Code Playgroud)

这工作完美并pygame成功安装在我的 Python 2.7 上。但是,Python 3 仍然没有pygame.

我还发现我可以使用pip3. 但是,我正在寻找一种使用 Homebrew 为 Python 3 安装 pygame 的方法。

cel*_*cel 5

添加--with-python3是这里的关键。您可以通过brew install --with-python3.

一般brew info <package-name>会给你额外的信息。在这种情况下brew info pygame打印:

homebrew/python/pygame: stable 1.9.2a0, HEAD
http://pygame.org
Not installed
From: https://github.com/Homebrew/homebrew-python/blob/master/pygame.rb
==> Dependencies
Required: sdl ?, sdl_image ?, sdl_mixer ?, sdl_ttf ?, smpeg ?, jpeg ?, libpng ?, portmidi ?, homebrew/python/numpy ?, freetype ?
==> Options
--with-python3
    Build with python3 support
--without-python
    Build without python2 support
--HEAD
    Install HEAD version
Run Code Online (Sandbox Code Playgroud)