Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(201924)

Side by Side Diff: Doc/using/windows.rst

Issue 20265: Bring Doc/using/windows up to date
Patch Set: Created 5 years, 9 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« Doc/faq/windows.rst ('K') | « Doc/faq/windows.rst ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 .. highlightlang:: none 1 .. highlightlang:: none
2 2
3 .. _using-on-windows: 3 .. _using-on-windows:
4 4
5 ************************* 5 *************************
6 Using Python on Windows 6 Using Python on Windows
7 ************************* 7 *************************
8 8
9 .. sectionauthor:: Robert Lehmann <lehmannro@gmail.com> 9 .. sectionauthor:: Robert Lehmann <lehmannro@gmail.com>
10 10
11 This document aims to give an overview of Windows-specific behaviour you should 11 This document aims to give an overview of Windows-specific behaviour you should
12 know about when using Python on Microsoft Windows. 12 know about when using Python on Microsoft Windows.
13 13
14 14
15 Installing Python 15 Installing Python
16 ================= 16 =================
17 17
18 Unlike most Unix systems and services, Windows does not require Python natively 18 Unlike most Unix systems and services, Windows does not require Python natively
19 and thus does not pre-install a version of Python. However, the CPython team 19 and thus does not pre-install a version of Python. However, the CPython team
20 has compiled Windows installers (MSI packages) with every `release 20 has compiled Windows installers (MSI packages) with every `release
21 <http://www.python.org/download/releases/>`_ for many years. 21 <http://www.python.org/download/releases/>`_ for many years.
22
23 .. sectionauthor:: Kathleen Weaver <kathleen@kweaver.org>
24
25 After running the installer, the following programs will be available in the
26 Start Menu under the title Python x.x where x.x is the version number.
27
28 * IDLE (Python GUI) - suitable for creating and running Python Scripts along with being a command line interpreter
29 * Python (command line) - Python command line interpreter
30 * Python Manuals - Python documentation
31 * Uninstall Python - which will uninstall these programs.
32
33 .. sectionauthor:: Robert Lehmann <lehmannro@gmail.com>
34
35 All versions can be installed and will run independently. The Windows command
36 prompt typically runs the last installed version of Python.
22 37
23 With ongoing development of Python, some platforms that used to be supported 38 With ongoing development of Python, some platforms that used to be supported
24 earlier are no longer supported (due to the lack of users or developers). 39 earlier are no longer supported (due to the lack of users or developers).
25 Check :pep:`11` for details on all unsupported platforms. 40 Check :pep:`11` for details on all unsupported platforms.
26 41
27 * `Windows CE <http://pythonce.sourceforge.net/>`_ is still supported. 42 * `Windows CE <http://pythonce.sourceforge.net/>`_ is still supported.
28 * The `Cygwin <http://cygwin.com/>`_ installer offers to install the `Python 43 * The `Cygwin <http://cygwin.com/>`_ installer offers to install the Python
29 interpreter <http://cygwin.com/packages/python>`_ as well; it is located under 44 interpreter as well; it is located under "Interpreters."
30 "Interpreters." (cf. `Cygwin package source
31 <ftp://ftp.uni-erlangen.de/pub/pc/gnuwin32/cygwin/mirrors/cygnus/
32 release/python>`_, `Maintainer releases
33 <http://www.tishler.net/jason/software/python/>`_)
34 45
35 See `Python for Windows <http://www.python.org/download/windows/>`_ 46 See `Python for Windows <http://www.python.org/download/windows/>`_
36 for detailed information about platforms with pre-compiled installers. 47 for detailed information about platforms with pre-compiled installers.
37 48
38 .. seealso:: 49 .. see also::
eric.araujo 2014/03/13 06:34:55 Roles and directives in reStructuredText are like
kathweaver 2014/03/18 02:27:06 Didn't see one but put it back.
39 50
40 `Python on XP <http://www.richarddooling.com/index.php/2006/03/14/python-on-x p-7-minutes-to-hello-world/>`_ 51 `Python on XP <http://www.richarddooling.com/index.php/2006/03/14/python-on-x p-7-minutes-to-hello-world/>`_
41 "7 Minutes to "Hello World!"" 52 "7 Minutes to "Hello World!""
42 by Richard Dooling, 2006 53 by Richard Dooling, 2006
43 54
44 `Installing on Windows <http://diveintopython.net/installing_python/windows.h tml>`_ 55 `Installing on Windows <http://diveintopython.net/installing_python/windows.h tml>`_
45 in "`Dive into Python: Python from novice to pro 56 in "`Dive into Python: Python from novice to pro
46 <http://diveintopython.net/index.html>`_" 57 <http://diveintopython.net/index.html>`_"
47 by Mark Pilgrim, 2004, 58 by Mark Pilgrim, 2004,
48 ISBN 1-59059-356-1 59 ISBN 1-59059-356-1
49 60
50 `For Windows users <http://swaroopch.com/text/Byte_of_Python:Installing_Pytho n#For_Windows_users>`_ 61 `For Windows users <http://swaroopch.com/text/Byte_of_Python:Installing_Pytho n#For_Windows_users>`_
eric.araujo 2014/03/13 06:34:55 This link changed (the right address is used just
kathweaver 2014/03/18 02:27:06 Done.
51 in "Installing Python" 62 in "Installing Python"
52 in "`A Byte of Python <http://www.byteofpython.info>`_" 63 in "`A Byte of Python <http://swaroopch.com/notes/python_en-installation/> `_"
eric.araujo 2014/03/13 06:34:55 I see that the byteofpython.info domain name is no
kathweaver 2014/03/18 02:27:06 Done.
53 by Swaroop C H, 2003 64 by Swaroop C H, 2003
54 65
55 66
56 Alternative bundles 67 Alternative bundles
57 =================== 68 ===================
58 69
59 Besides the standard CPython distribution, there are modified packages including 70 Besides the standard CPython distribution, there are modified packages including
60 additional functionality. The following is a list of popular versions and their 71 additional functionality. The following is a list of popular versions and their
61 key features: 72 key features:
62 73
63 `ActivePython <http://www.activestate.com/activepython/>`_ 74 `ActivePython <http://www.activestate.com/activepython/>`_
64 Installer with multi-platform compatibility, documentation, PyWin32 75 Installer with multi-platform compatibility, documentation, PyWin32
65 76
66 `Enthought Python Distribution <http://www.enthought.com/products/epd.php>`_ 77 `Enthought Python Distribution <http://www.enthought.com/products/epd.php>`_
67 Popular modules (such as PyWin32) with their respective documentation, tool 78 Popular modules (such as PyWin32) with their respective documentation, tool
68 suite for building extensible Python applications 79 suite for building extensible Python applications
69 80
70 Notice that these packages are likely to install *older* versions of Python. 81 Notice that these packages are likely to install *older* versions of Python.
71 82
83 .. sectionauthor:: Kathleen Weaver <kathleen@kweaver.org>
eric.araujo 2014/03/13 06:34:55 Sections are created by headings, so a directive a
kathweaver 2014/03/18 02:27:06 I removed those. Is there a way I should indicate
84
85 Running Python
86 ==============
87
88 The following shortcuts are creating during installation and can be used to run Python:
Zach Ware 2014/03/13 15:11:23 creating -> created
kathweaver 2014/03/18 02:27:06 Done.
89
90 * Python (command line) - Python command line interpreter
91 * IDLE (Python GUI) - suitable for creating and running Python Scripts along wit h being a command line interpreter
92 * Select Python through File Explorer - this works the same as running the Pytho n shortcut.
93 Find the Python directory and double click python
94
95 While these tools are useful to get started, it is still recommended to run
96 Python through the Windows Command line and set environment variables.
97 Directions for setting environments are located at :ref:`setting-envvars`.
98 Detailed directions for running Python are at :ref:`running-windows`.
72 99
73 100
74 Configuring Python 101 Python scripts are associated with Python and will run when opened, but the
75 ================== 102 window will close immediately, usually faster than the user can read. A work
103 around is to add::
76 104
77 In order to run Python flawlessly, you might have to change certain environment 105 raw_input()
Zach Ware 2014/03/13 15:11:23 raw_input doesn't exist in Python 3, just input().
kathweaver 2014/03/18 02:27:06 I will remove. It was something I found in my res
78 settings in Windows.
79 106
107 to the end of the script. The window will remain open until the user hits the e nter key.
80 108
81 .. _setting-envvars: 109 .. sectionauthor:: Robert Lehmann <lehmannro@gmail.com>
82
83 Excursus: Setting environment variables
84 ---------------------------------------
85
86 Windows has a built-in dialog for changing environment variables (following
87 guide applies to XP classical view): Right-click the icon for your machine
88 (usually located on your Desktop and called "My Computer") and choose
89 :menuselection:`Properties` there. Then, open the :guilabel:`Advanced` tab
90 and click the :guilabel:`Environment Variables` button.
91
92 In short, your path is:
93
94 :menuselection:`My Computer
95 --> Properties
96 --> Advanced
97 --> Environment Variables`
98
99 In this dialog, you can add or modify User and System variables. To change
100 System variables, you need non-restricted access to your machine
101 (i.e. Administrator rights).
102
103 Another way of adding variables to your environment is using the :command:`set`
104 command::
105
106 set PYTHONPATH=%PYTHONPATH%;C:\My_python_lib
107
108 To make this setting permanent, you could add the corresponding command line to
109 your :file:`autoexec.bat`. :program:`msconfig` is a graphical interface to this
110 file.
111
112 Viewing environment variables can also be done more straight-forward: The
113 command prompt will expand strings wrapped into percent signs automatically::
114
115 echo %PATH%
116
117 Consult :command:`set /?` for details on this behaviour.
118
119 .. seealso::
120
121 http://support.microsoft.com/kb/100843
122 Environment variables in Windows NT
123
124 http://support.microsoft.com/kb/310519
125 How To Manage Environment Variables in Windows XP
126
127 http://www.chem.gla.ac.uk/~louis/software/faq/q1.html
128 Setting Environment variables, Louis J. Farrugia
129
130
131 .. _windows-path-mod:
132 110
133 Finding the Python executable 111 Finding the Python executable
134 ----------------------------- 112 -----------------------------
135 113
136 .. versionchanged:: 3.3 114 .. versionchanged:: 3.3
137 115
138 Besides using the automatically created start menu entry for the Python 116 Besides using the automatically created start menu entry for the Python
139 interpreter, you might want to start Python in the command prompt. As of 117 interpreter, you might want to start Python in the command prompt. As of
140 Python 3.3, the installer has an option to set that up for you. 118 Python 3.3, the installer has an option to set that up for you.
141 119
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 opens a terminal, which stays open even if the program uses a GUI. If you do 202 opens a terminal, which stays open even if the program uses a GUI. If you do
225 not want this to happen, use the extension ``.pyw`` which will cause the script 203 not want this to happen, use the extension ``.pyw`` which will cause the script
226 to be executed by :program:`pythonw.exe` by default (both executables are 204 to be executed by :program:`pythonw.exe` by default (both executables are
227 located in the top-level of your Python installation directory). This 205 located in the top-level of your Python installation directory). This
228 suppresses the terminal window on startup. 206 suppresses the terminal window on startup.
229 207
230 You can also make all ``.py`` scripts execute with :program:`pythonw.exe`, 208 You can also make all ``.py`` scripts execute with :program:`pythonw.exe`,
231 setting this through the usual facilities, for example (might require 209 setting this through the usual facilities, for example (might require
232 administrative rights): 210 administrative rights):
233 211
234 #. Launch a command prompt. 212 #. Launch a command prompt [Windows 8 - Launch Command Prompt (Admin)]
Zach Ware 2014/03/13 15:11:23 I don't think this new comment adds much, consider
kathweaver 2014/03/18 02:27:06 Actually it is a new available option for Windows
235 #. Associate the correct file group with ``.py`` scripts:: 213 #. Associate the correct file group with ``.py`` scripts::
236 214
237 assoc .py=Python.File 215 assoc .py=Python.File
238 216
239 #. Redirect all Python files to the new executable:: 217 #. Redirect all Python files to the new executable::
240 218
241 ftype Python.File=C:\Path\to\pythonw.exe "%1" %* 219 ftype Python.File=C:\Path\to\pythonw.exe "%1" %*
242
243 220
Zach Ware 2014/03/13 15:11:23 I don't think the blank line here should have been
kathweaver 2014/03/18 02:27:06 Done.
244 .. _launcher: 221 .. _launcher:
245 222
246 Python Launcher for Windows 223 Python Launcher for Windows
247 =========================== 224 ===========================
248 225
249 .. versionadded:: 3.3 226 .. versionadded:: 3.3
250 227
251 The Python launcher for Windows is a utility which aids in the location and 228 The Python launcher for Windows is a utility which aids in the location and
252 execution of different Python versions. It allows scripts (or the 229 execution of different Python versions. It allows scripts (or the
253 command-line) to indicate a preference for a specific Python version, and 230 command-line) to indicate a preference for a specific Python version, and
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 by Mark Hammond and Andy Robinson, O'Reilly Media, 2000, 572 by Mark Hammond and Andy Robinson, O'Reilly Media, 2000,
596 ISBN 1-56592-621-8 573 ISBN 1-56592-621-8
597 574
598 `A Python for Windows Tutorial <http://www.imladris.com/Scripts/PythonForWind ows.html>`_ 575 `A Python for Windows Tutorial <http://www.imladris.com/Scripts/PythonForWind ows.html>`_
599 by Amanda Birmingham, 2004 576 by Amanda Birmingham, 2004
600 577
601 :pep:`397` - Python launcher for Windows 578 :pep:`397` - Python launcher for Windows
602 The proposal for the launcher to be included in the Python distribution. 579 The proposal for the launcher to be included in the Python distribution.
603 580
604 581
OLDNEW
« Doc/faq/windows.rst ('K') | « Doc/faq/windows.rst ('k') | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+