O'Reilly Introduction to Python/Section 1/Windows set up Python: Difference between revisions

Content added Content deleted
imported>Jesstess
No edit summary
imported>Jesstess
No edit summary
Line 1: Line 1:
[[File:Python-logo.png|300px]]
[[File:Python-logo.png|300px]]


We are going to install Python version 2.7.5.
We are going to install Python version 3.4.1.


If you already have Python installed, check the Python version: if the version is between Python 2.5 and Python 2.7, you can use it for this class and can skip to [[Windows_set_up_Python#Put_Python_on_the_PATH|setting your Path]].
If you already have Python installed, check the Python version: if the version number starts with a 3 (as opposed to a 2), you can use it for this class and can skip to [[Windows_set_up_Python#Put_Python_on_the_PATH|setting your Path]].


== Download and install Python ==
== Download and install Python ==


<ol>
<ol>
<li>Click http://python.org/ftp/python/2.7.5/python-2.7.5.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.</li>
<li>Click https://www.python.org/ftp/python/3.4.1/python-3.4.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.</li>
<li><b>Open a terminal (we will be doing this multiple times, so make a note of how to do this!)</b>:
<li><b>Open a terminal (we will be doing this multiple times, so make a note of how to do this!)</b>:
* On Windows Vista or Windows 7: click on the Start menu (the Windows logo in the lower left of the screen), type <code>cmd</code> into the Search field directly above the Start menu button, and click on "cmd" in the search results above the Search field.
* On Windows Vista or Windows 7: click on the Start menu (the Windows logo in the lower left of the screen), type <code>cmd</code> into the Search field directly above the Start menu button, and click on "cmd" in the search results above the Search field.
Line 18: Line 18:


<pre>
<pre>
\Python27\python.exe
\Python34\python.exe
</pre>
</pre>


and pressing Enter. You should see something like
and pressing Enter. You should see something like
<pre>
<pre>
Python 2.7.5 (r271:86832, ...) on win32
Python 3.4.1 (v3.4.1:d047928ae3f6, May 13 2013, 12:45:22) on win32
Type "help", "copyright", "credits" or "license" for more information.
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>>
Line 42: Line 42:
== Put Python on the PATH ==
== Put Python on the PATH ==


You might have noticed that you typed a "full path" 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 configure your computer so that you can run Python without typing the ''Python27'' directory name.
You might have noticed that you typed a "full path" to the Python application above when launching Python (<code>python.exe</code> is the application, but we typed <code>\Python34\python.exe</code>). In this step, you will configure your computer so that you can run Python without typing the ''Python34'' directory name.


=== Get to System Properties ===
=== Get to System Properties ===
Line 69: Line 69:
# 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. 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).
#* 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! <pre>;c:\python27\;c:\python27\scripts</pre>
# 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! <pre>;c:\python34\;c:\python34\scripts</pre>
# Press "OK" to close out the system properties window.
# Press "OK" to close out the system properties window.
# Test your change:
# Test your change: