Instructions for setting up Python on Windows.
If you believe you already have Python installed, please let a staff member know before completing these steps.
Click http://python.org/ftp/python/2.7.1/python-2.7.1.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.
We will be doing this multiple times, so please make a note of how to do this!
note: | 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. |
---|
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.
>>>
note: | 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. |
---|
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).
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 Python27python.exe). In this step, you will configure your computer so that you can run Python without typing the Python27 directory name.
A window labeled “View basic information about your computer” will appear.
A window with the title “System Properties” will appear.
Within System Properties, make sure you are in the tab labeled “Advanced”.
Click the button labeled “Environment Variables”.
A window labeled “Environment Variables” will appear.
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).
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
Hit “OK” to close out the system properties window.
Test your change:
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.
Type python into the command prompt to start Python
Notice that you now get a Python interpreter, indicated by the change to a >>> prompt.
Exit the Python prompt by typing:
exit()
Now you’re back at the Windows command prompt (C:).
You have Python installed and configured.