Page 39 -
P. 39

meet python


           Install Python 3


           Before you write and run Python code, you need to make sure the Python
           interpreter is on your computer. In this book, you’ll start out with Release 3 of
           Python, the very latest (and best) version of the language.
          A release of Python might already be on your computer. Mac OS X comes
           with Python 2 preinstalled, as do most versions of Linux (which can also ship
           with Release 3). Windows, in contrast, doesn’t include any release of Python.
           Let’s check your computer for Python 3. Open up a command-line prompt
           and, if you are using Mac OS X or Linux, type:

                                python3 -V
                                                                                               Do this!
                                                         That’s an UPPERCASE
                                                        “v”, by the way.
           On Windows, use this command:
                  c:\Python31\python.exe -V
                                                                                If Python 3 is missing from
                                                                                your computer, download
                                                                                a copy for your favorite OS
          Using the                                                             from the www.python.org
                                                                                website.
           UPPERCASE “v”
           results in the Python
           version appearing on   File  Edit   Window  Help   WhichPython?
                              $ python3 -V
           screen.            Python 3.1.2
                              $
           Without the        $ python3
                              Python 3.1.2 (r312:79360M, Mar 24 2010, 01:33:18)
           UPPERCASE “v”,
           you are taken      [GCC 4.0.1 (Apple Inc. build 5493)] on darwin
                              Type "help", "copyright", "credits" or "license" for more info.
            into the Python   >>>
            interpreter.      >>> quit()
                              $
          Use the quit()
          command to exit
          the interpreter and
          return to your OS
          prompt.




           When you install Python 3, you also get IDLE, Python’s simple—yet
           surprisingly useful— integrated development environment. IDLE includes a
           color syntax-highlighting editor, a debugger, the Python Shell, and a complete
           copy of Python 3’s online documentation set.

           Let’s take a quick look at IDLE.

                                                                                        you are here 4    3
   34   35   36   37   38   39   40   41   42   43   44