Columbus Python Workshop 1/Friday/Windows set up Python

From OpenHatch wiki
Jump to navigation Jump to search

Download and install Python[edit]

If you believe you already have Python installed, please let a staff member know before completing these steps.

  1. Click http://python.org/ftp/python/2.7.3/python-2.7.3.msi and choose "run" if you have the option to. Otherwise, save it to your Desktop, then minimize windows to see your desktop, and double click on it to start the installer. Follow the installer instructions to completion.
  2. Open a command prompt (we will be doing this multiple times, so make a note of how to do this!):
    • On Windows Vista or Windows 7: click on the Start menu (the Windows logo in the lower left of the screen), type cmd into the Search field directly above the Start menu button, and click on "cmd" in the search results above the Search field.
    • On Windows XP: click on the Start menu (the Windows logo in the lower left of the screen), click on "Run...", type cmd into the text box, and hit enter.

    You now have what's 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.
  3. At this C:\ prompt that appears, test your Python install by typing
    \Python27\python.exe
    

    and hitting enter. You should see something like

    Python 2.7.1 (r271:86832, ...) on win32
    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.

  4. To exit the Python prompt, type
    exit()
    
    and press Enter. This will take you back to the Windows command prompt (the C:\ you saw earlier).

Put Python on the PATH[edit]

You might have noticed that you typed a "full path" to the Python application above when launching Python (python.exe is the application, but we typed \Python27\python.exe). In this step, you will configure your computer so that you can run Python without typing the Python27 directory name.

Get to System Properties[edit]

  1. Open up "My Computer" by clicking on the Start menu or the Windows logo in the lower-left hand corner, and navigate to "My Computer" (for Windows XP) or "Computer" (For Vista and Windows 7).
  2. Right-click on the empty space in the window, and choose Properties.

If you're using XP[edit]

A window labeled "System Properties" will pop up.

  1. Click the "Advanced" tab.

If you're not using XP[edit]

A window labeled "View basic information about your computer" will appear.

  1. In this window, click "Advanced system settings"

A window with the title "System Properties" will appear.

Edit the Path[edit]

  1. Within System Properties, make sure you are in the tab labeled "Advanced".
  2. Click the button labeled "Environment Variables".
    • A window labeled "Environment Variables" will appear.
  3. In this window, the screen is split between "User variables" and "System variables". Within "System variables", scroll down and find the one labeled Path. Click the "Edit..." button.
    • A window with the "Variable name" and the "Variable value" should appear. The "Variable value" will already have some text in it; click in the box to unhighlight it (we don't want to accidentally delete that text).
  4. In the "Variable value" box, scroll to the end. Add the following text, and hit OK. Make sure to include the semicolon at the start!
    ;c:\python27\;c:\python27\scripts
  5. Hit "OK" to close out the system properties window.
  6. Test your change:
    1. Open up a new command prompt: you do this the same way you did above when installing python. This needs to be a new command prompt because the changes you just made didn't take affect in prompts that were already open.
    2. Type python into the command prompt to start Python
    3. Notice that you now get a Python interpreter, indicated by the change to a >>> prompt.
    4. Exit the Python prompt by typing
      exit()
      and hitting enter. Now you're back at the Windows command prompt (C:\).

Install IPython[edit]

Get 7-zip[edit]

You can skip this step if your computer already has 7-zip or another zipping/unzipping program installed. If you don't know, you can try "Get Distribute" and coming back here if "7-zip" doesn't appear in the right-click menu of step 2.

  1. Click http://sourceforge.net/projects/sevenzip and press the "Download" button on 7-zip's webpage.
  2. Choose "run" if you have the option to. Otherwise, save it to your Desktop, then minimize windows to see your desktop, and double click on it to start the installer. Follow the installer instructions to completion.

Get Distribute[edit]

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 http://pypi.python.org/packages/source/d/distribute/distribute-0.6.34.tar.gz 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 command prompt 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 command prompt 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 command prompt window, type "python setup.py install" and hit "Enter".

Complete installation[edit]

At any command prompt window, type

easy_install pip

then

pip install pyreadline ipython tornado pyzmq 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![edit]

You have Python and IPython installed and configured.

« Back to the Friday setup page