Difference between revisions of "Python on Windows"

From OpenHatch wiki
Jump to navigation Jump to search
imported>Paulproteus
imported>Adamf
Line 3: Line 3:
 
<ol>
 
<ol>
 
<li>Go to http://python.org/download/ and download the latest version of Python 2.7 (2.7.1 at the time of writing). Unless you know otherwise, get the "Windows Installer" version, and not the "Windows X86-64 Installer" version.</li>
 
<li>Go to http://python.org/download/ and download the latest version of Python 2.7 (2.7.1 at the time of writing). Unless you know otherwise, get the "Windows Installer" version, and not the "Windows X86-64 Installer" version.</li>
<li>Start up a command prompt by clicking on the Start menu, clicking the "Run..." option, typing "cmd", and hitting enter. If you are using Windows Vista, you should click on the Start menu, type "cmd" into the Search field directly above the Start menu button, and click on "cmd" in the search results above the Search field.</li>
+
<li>Start up a command prompt by clicking on the Start menu (or the Windows logo in the lower-left hand corner), clicking the "Run..." option, typing "cmd", and hitting enter. If you are using Windows Vista or Windows 7, you should click on the Start menu, type "cmd" into the Search field directly above the Start menu button, and click on "cmd" in the search results above the Search field.</li>
<li>Test your Python install by typing
+
<li>At the c:\ prompt that appears, test your Python install by typing
  
 
<pre>
 
<pre>
Line 21: Line 21:
 
  exit()
 
  exit()
  
and press Enter. This will take you back to the Windows command prompt.</li>
+
and press Enter. This will take you back to the Windows command prompt (the c:\ you saw earlier).</li>
 
</ol>
 
</ol>
  
Line 34: Line 34:
 
=== Get to System Properties ===
 
=== Get to System Properties ===
  
# Open up "My Computer"
+
# 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).
 
# ''Right-click'' on the empty space in the window, and choose ''Properties'
 
# ''Right-click'' on the empty space in the window, and choose ''Properties'
 
#* A window labeled "View basic information about your computer" should appear
 
#* A window labeled "View basic information about your computer" should appear
Line 47: Line 47:
 
# 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.
 
# 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.
 
#* A window with the "Variable name" and the "Variable value" should appear.
# In the "Variable value", scroll to the end. Add this text, and hit OK. Make sure to include the semicolon at the start! <pre>;c:/python27/;c:/python27/scripts</pre>
+
# In the "Variable value", scroll to the end. Add this text, and hit OK. Make sure to include the semicolon at the start! <pre>;c:\python27\;c:\python27\scripts</pre>
 
# Hit "OK" to close out the system properties changes.
 
# Hit "OK" to close out the system properties changes.
 
# Test it:
 
# Test it:

Revision as of 21:45, 11 May 2011

Download and install Python

  1. Go to http://python.org/download/ and download the latest version of Python 2.7 (2.7.1 at the time of writing). Unless you know otherwise, get the "Windows Installer" version, and not the "Windows X86-64 Installer" version.
  2. Start up a command prompt by clicking on the Start menu (or the Windows logo in the lower-left hand corner), clicking the "Run..." option, typing "cmd", and hitting enter. If you are using Windows Vista or Windows 7, you should click on the Start menu, type "cmd" into the Search field directly above the Start menu button, and click on "cmd" in the search results above the Search field.
  3. At the 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.
    >>>
    
  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).

Required step: Put Python on the PATH

You might have noticed that you typed a directory name above when launching Python. In this step, you will reconfigure your computer to put Python on the system PATH so that you can run it without typing the Python27 directory name.

This will take about 5 extra minutes, and it is essential to an easy life using Python down the road.

(Note: These steps are based on a video that we recommend you watch. They should work equally well on Windows XP, Vista, and 7.)

Get to System Properties

  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'
    • A window labeled "View basic information about your computer" should appear
  3. In the new window, click "Advanced system settings"
    • A window should appear whose title is "System Properties".

Edit the Path

  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" should 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.
  4. In the "Variable value", scroll to the end. Add this 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 changes.
  6. Test it:
    • Open up a command prompt
    • Type just "python" into the command prompt
    • Notice that you now get a Python interpreter.
  7. Go find an instructor and show them that you did this right!

Success

You have Python installed.

« Back to the Friday setup page