Installing Pygame Zero - Read The Docs

Installing Pygame Zero¶

On desktop systems¶

pip install pgzero

This will also install Pygame. Pre-compiled Pygame packages are available to pip for Windows & Linux (32-bit and 64-bit), and for Mac OS (64-bit only). If you have a different system, you’ll need to find a way to install pygame first. Make sure you are using Python 3 not Python 2.

Mac¶

In a Terminal window, type

pip install pgzero

Note that there are currently no Wheels for Pygame that support python 3.4 for Mac, so you will need to upgrade Python to >=3.6 (or use python 2.7) in order to be able to install pygame. For a list of available Wheels, please visit pyPI_

Linux¶

In a terminal window, type

sudo pip install pgzero

Some Linux systems call it pip3; if the above command printed something like sudo: pip: command not found then try:

sudo pip3 install pgzero

Sometimes pip is not installed and needs to be installed. If so try this before running the above commands again:

sudo python3 -m ensurepip

On Raspberry Pi¶

pgzero has been installed by default since the release of Raspbian Jessie in September 2015!

For flake8/pyflakes¶

Checkers like Pyflakes are unaware of Pygame Zero’s extra builtins.

If you use flake8, you can add Pygame Zero’s list of builtins to your flake8 configuration file:

[flake8] builtins=Actor,Rect,ZRect,animate,clock,exit,images,keyboard,keymods,keys,mouse,music,screen,sounds,storage,tone

If you use pyflakes directly then this is configured using the environment variable $PYFLAKES_BUILTINS. On Linux and Mac you could write this in your terminal or put it in your shell configuration file (like ~/.bashrc)

PYFLAKES_BUILTINS=Actor,Rect,ZRect,animate,clock,exit,images,keyboard,keymods,keys,mouse,music,screen,sounds,storage,tone exportPYFLAKES_BUILTINS

On Windows:

set PYFLAKES_BUILTINS=Actor,Rect,ZRect,animate,clock,exit,images,keyboard,keymods,keys,mouse,music,screen,sounds,storage,tone

Logo of Pygame Zero

Pygame Zero

Navigation

  • Introduction to Pygame Zero
  • Migrating from Scratch
  • Event Hooks
  • Built-in Objects
  • Installing Pygame Zero
    • On desktop systems
    • On Raspberry Pi
    • For flake8/pyflakes
  • Running Pygame Zero in IDLE and other IDEs
  • Examples
  • Tutorials and Resources
  • Other libraries like Pygame Zero
  • Changelog
  • Laptop Stickers
  • Roadmap
  • Principles of Pygame Zero
  • Contributing to Pygame Zero

Related Topics

  • Documentation overview
    • Previous: Text Formatting
    • Next: Running Pygame Zero in IDLE and other IDEs
©2015, Daniel Pope. | Powered by Sphinx 8.2.3 & Alabaster 1.0.0

Từ khóa » Cài đặt Pygame