Columbus Python Workshop 1/Friday/OSX set up Python
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.
- 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. - Test your Python install at the command prompt. Type
python
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.
- You just started Python! The
- To exit the Python prompt, type
exit()
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!
- Click http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz and save it to your Desktop.
- Minimize windows to see your desktop. Right-click on distribute-0.6.34.tar.gz. Click on "7-zip", then "Extract to here".
- 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".
- Open a Terminal window again (see above). At the
C:\
prompt, type "cd " (with a space!) *Don't* hit "Enter" yet. - 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".
- In the Terminal window, type "python setup.py 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".
Success!
You have tested your Python installation.