Jump to content

Python on Windows: Difference between revisions

no edit summary
No edit summary
No edit summary
(3 intermediate revisions by the same user not shown)
== Download and install Python ==
If you believe you already have Python installed, please let a staff member know before completing these steps.
* On Windows XP: click on the Start menu (the Windows logo in the lower left of the screen), click on "Run...", type <code>cmd</code> into the text box, and hit enter.
<br />
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.
<li>At this <code>C:\</code> prompt that appears, test your Python install by typing
== Required step: Put Python on the PATH ==
You might have noticed that you typed a directory"full namepath" to the Python application above when launching Python (<code>python.exe</code> is the application, but we typed <code>\Python27\python.exe</code>). In this step, you will reconfigureconfigure your computer to put Python on the system PATH so that you can run itPython 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.
=== Get to System Properties ===
# 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''.
==== If you're using XP ====
# A window labeled "System Properties" will pop up.
#* Click the "Advanced" tab.
# A window labeled "System Properties" will pop up.
==== If you're not ====
# A window labeled "View basic information about your computer" should appear
#* InClick this window, clickthe "Advanced" system settings"tab.
#* A window should appear whose title is "System Properties".
==== If you're not using XP ====
# A window labeled "View basic information about your computer" shouldwill appear.
# In this window, click "Advanced system settings"
#* A window shouldwith appear whosethe title is "System Properties" will appear.
=== Edit the Path ===
# Within System Properties, make sure you are in the tab labeled "Advanced".
# Click the button labeled "Environment Variables".
#* A window labeled "Environment Variables" shouldwill 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 If"Variable youvalue" will already have some words listedtext in the "Variable value", thenit; click in the box to unhighlight it. Make(we suredon't thatwant theto currentaccidentally path listed in the box is '''NOT''' highlighted!delete that text).
# In the "Variable value" box, scroll to the end. Add thisthe following 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.
# Test ityour change:
#*# Open up a <b>new</b> command prompt: you do this the same way you did above when installing python. This needs to be a <b>new</b> command prompt orbecause the changes you wonjust made didn't havetake theaffect shorterin pathsprompts availablethat forwere youralready use!open.
#*# Type just "<code>python"</code> into the command prompt to start Python
#*# Notice that you now get a Python interpreter, indicated by the change to a <code>>>></code> prompt.
## Exit the Python prompt by typing <pre>exit()</pre> and hitting enter. Now you're back at the Windows command prompt (<code>C:\</code>).
== Success! ==
You have Python installed and configured.
[[Boston Python workshop 2/Friday setup|&laquo; Back to the Friday setup page]]
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.