Columbus Python Workshop 1/Friday/OSX set up Python

From OpenHatch wiki

OS X ships with Python installed, so the goal of this page is to make sure you can start a Terminal and run Python from the command line.

  1. Start up a Terminal. You can find the Terminal application through Spotlight, or navigate to Applications/Utilities/Terminal.

    This Terminal contains something called a command prompt. This command prompt is another way of navigating your computer and running programs -- just textually instead of graphically. We are going to be running Python and Python scripts from this command prompt.
  2. Test your Python install at the command prompt. Type

    and hit enter. You should see something like

    Python 2.7.1 (r261:67515, Feb 11 2010, 00:51:29) 
    [GCC 4.2.1 (Apple Inc. build 5646)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    • You just started Python! The >>> indicates that you are at a new type of prompt -- a Python prompt. The command prompt let's you navigate your computer and run programs, and the Python prompt lets you write and run Python code interactively.
    • If the Python version number (2.7.1 in the example above) is not a number between 2.4 and 2.7 (ignoring the number after the second dot), tell a staff member.
  3. To exit the Python prompt, type
    and press Enter. This will take you back to the OS X command prompt.

Install IPython

Get Distribute

Distribute is a Python package that makes it very easy to install other Python packages onto your machine. Unfortunately, getting Distribute itself is a little bit of a pain!

  1. Click and save it to your Desktop.
  2. Minimize windows to see your desktop. Right-click on distribute-0.6.34.tar.gz. Click on "7-zip", then "Extract to here".
  3. Double-click on the folder "dist" to enter it. Right-click on distribute-0.6.34.tar, click on "7-zip", then "Extract to here".
  4. Open a Terminal window again (see above). At the C:\ prompt, type "cd " (with a space!) *Don't* hit "Enter" yet.
  5. Click the icon for the "distribute-0.6.34" folder that appeared in step 3 and, holding down your mouse button, drag it onto the Terminal window from step 4. This is a shortcut for typing the full path name of the "distribute-0.6.34" folder. Now hit "Enter".
  6. In the Terminal window, type "python install" and hit "Enter".

Complete installation

At any command prompt window, type

easy_install pyreadline ipython tornado pyzmq ipython-notebook ipython-doctester

Now test that IPython Notebook is ready by typing

ipython notebook

It should bring up a tab in your web browser titled "IP[y]:Notebook".


You have tested your Python installation.

« Back to the Friday setup page