diff -r f8b40d33e45d Doc/faq/windows.rst --- a/Doc/faq/windows.rst Tue Mar 18 09:20:25 2014 -0500 +++ b/Doc/faq/windows.rst Sun Mar 23 10:05:56 2014 -0500 @@ -11,15 +11,19 @@ .. contents:: .. XXX need review for Python 3. - XXX need review for Windows Vista/Seven? +.. _running-windows: How do I run a Python program under Windows? -------------------------------------------- -This is not necessarily a straightforward question. If you are already familiar -with running programs from the Windows command line then everything will seem -obvious; otherwise, you might need a little more guidance. +This is not necessarily a straightforward question. The situation has been +made somewhat simpler since Python 3.3, which introduced the launcher for +Windows. Use is discussed at :ref:`launcher`. + +If you are already familiar with running programs from the Windows command +line then everything will seem obvious; otherwise, you might need a little +more guidance. .. sidebar:: |Python Development on XP|_ :subtitle: `Python Development on XP`_ @@ -34,11 +38,13 @@ http://www.showmedo.com/videos/series?name=pythonOzsvaldPyNewbieSeries Unless you use some sort of integrated development environment, you will end up -*typing* Windows commands into what is variously referred to as a "DOS window" -or "Command prompt window". Usually you can create such a window from your -Start menu; under Windows 7 the menu selection is :menuselection:`Start --> -Programs --> Accessories --> Command Prompt`. You should be able to recognize -when you have started such a window because you will see a Windows "command +*typing* Windows commands into what is variously referred to as a "DOS window" +or "Command prompt window". Usually you can create such a window from your +Start menu; under Windows 7 the menu selection is :menuselection:`Start --> +Programs --> Accessories --> Command Prompt`; under Windows 8 right click the +Windows Icon or type Command Prompt at the Start Menu. Make sure to pick the +Command Prompt followed by (Admin). You should be able to recognize when +you have started such a window because you will see a Windows "command prompt", which usually looks like this:: C:\> @@ -66,7 +72,7 @@ You should then see something like:: - Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit (Intel)] on win32 + Python 3.4.0 (v3.4.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> @@ -81,12 +87,11 @@ HelloHelloHello Many people use the interactive mode as a convenient yet highly programmable -calculator. When you want to end your interactive Python session, hold the Ctrl -key down while you enter a Z, then hit the "Enter" key to get back to your -Windows command prompt. +calculator. When you want to end your interactive Python session, use exit() +or quit() function to get back to your Windows command prompt. You may also find that you have a Start-menu entry such as :menuselection:`Start ---> Programs --> Python 3.3 --> Python (command line)` that results in you +--> Programs --> Python 3.4 --> Python (command line)` that results in you seeing the ``>>>`` prompt in a new window. If so, the window will disappear after you enter the Ctrl-Z character; Windows is running a single "python" command in the window, and closes it when you terminate the interpreter. @@ -131,14 +136,15 @@ c:\Python33\python -starts up the interpreter as above (and don't forget you'll need a "CTRL-Z" and -an "Enter" to get out of it). Once you have verified the directory, you can +starts up the interpreter as above. +Once you have verified the directory, you can add it to the system path to make it easier to start Python by just running the ``python`` command. This is currently an option in the installer as of CPython 3.3. -More information about environment variables can be found on the -:ref:`Using Python on Windows ` page. +If you need further assistance with Environment Settings see: +`How to set the path and environment variables in Windows. `_ +Note: Both Windows 7 and Windows 8 use similar methods to accomplish the task. How do I make Python scripts executable? ---------------------------------------- @@ -204,7 +210,7 @@ be a DLL to handle importing modules that are themselves DLL's. (This is the first key undocumented fact.) Instead, link to :file:`python{NN}.dll`; it is typically installed in ``C:\Windows\System``. *NN* is the Python version, a - number such as "33" for Python 3.3. + number such as "33" for Python 3.4. You can link to Python in two different ways. Load-time linking means linking against :file:`python{NN}.lib`, while run-time linking means linking @@ -341,4 +347,3 @@ Simply rename the downloaded file to have the .TGZ extension, and WinZip will be able to handle it. (If your copy of WinZip doesn't, get a newer one from http://www.winzip.com.) - diff -r f8b40d33e45d Doc/using/windows.rst --- a/Doc/using/windows.rst Tue Mar 18 09:20:25 2014 -0500 +++ b/Doc/using/windows.rst Sun Mar 23 10:05:56 2014 -0500 @@ -11,10 +11,6 @@ This document aims to give an overview of Windows-specific behaviour you should know about when using Python on Microsoft Windows. -.. XXX (ncoghlan) - - This looks rather stale to me... - Installing Python ================= @@ -24,17 +20,26 @@ has compiled Windows installers (MSI packages) with every `release `_ for many years. +After running the installer, the following programs will be available in the +Start Menu under the title Python x.x where x.x is the version number. + + * IDLE (Python GUI) - a simple IDE for Python, written in Python using + Tkinter + * Python (command line) - Python command line interpreter + * Python Manuals - Python documentation + * Module Docs - Module Documentation + * Uninstall Python - which will uninstall these programs. + +Multiple versions of Python can be installed next to each other without +interfering with each other. + With ongoing development of Python, some platforms that used to be supported earlier are no longer supported (due to the lack of users or developers). Check :pep:`11` for details on all unsupported platforms. * `Windows CE `_ is still supported. -* The `Cygwin `_ installer offers to install the `Python - interpreter `_ as well; it is located under - "Interpreters." (cf. `Cygwin package source - `_, `Maintainer releases - `_) +* The `Cygwin `_ installer offers to install the Python + interpreter as well; it is located under "Interpreters." See `Python for Windows `_ for detailed information about platforms with pre-compiled installers. @@ -51,12 +56,6 @@ by Mark Pilgrim, 2004, ISBN 1-59059-356-1 - `For Windows users `_ - in "Installing Python" - in "`A Byte of Python `_" - by Swaroop C H, 2003 - - Alternative bundles =================== @@ -73,67 +72,28 @@ Notice that these packages are likely to install *older* versions of Python. +Running Python +============== +The following shortcuts are created during installation and can be used to run Python: -Configuring Python -================== +* Python (command line) +* IDLE (Python GUI) -In order to run Python flawlessly, you might have to change certain environment -settings in Windows. +You can also use the following to run Python: +* Select Python through File Explorer +* Find the Python directory and double click python + +While these tools are useful to get started, it is still recommended to run +Python through the launcher for Windows. Use is discussed +at :ref:`launcher`. + +Python scripts are associated with Python and will run when clicked, but the +window will close as soon as the script exits. .. _setting-envvars: -Excursus: Setting environment variables ---------------------------------------- - -Windows has a built-in dialog for changing environment variables (following -guide applies to XP classical view): Right-click the icon for your machine -(usually located on your Desktop and called "My Computer") and choose -:menuselection:`Properties` there. Then, open the :guilabel:`Advanced` tab -and click the :guilabel:`Environment Variables` button. - -In short, your path is: - - :menuselection:`My Computer - --> Properties - --> Advanced - --> Environment Variables` - -In this dialog, you can add or modify User and System variables. To change -System variables, you need non-restricted access to your machine -(i.e. Administrator rights). - -Another way of adding variables to your environment is using the :command:`set` -command:: - - set PYTHONPATH=%PYTHONPATH%;C:\My_python_lib - -To make this setting permanent, you could add the corresponding command line to -your :file:`autoexec.bat`. :program:`msconfig` is a graphical interface to this -file. - -Viewing environment variables can also be done more straight-forward: The -command prompt will expand strings wrapped into percent signs automatically:: - - echo %PATH% - -Consult :command:`set /?` for details on this behaviour. - -.. seealso:: - - http://support.microsoft.com/kb/100843 - Environment variables in Windows NT - - http://support.microsoft.com/kb/310519 - How To Manage Environment Variables in Windows XP - - http://www.chem.gla.ac.uk/~louis/software/faq/q1.html - Setting Environment variables, Louis J. Farrugia - - -.. _windows-path-mod: - Finding the Python executable ----------------------------- @@ -141,25 +101,17 @@ Besides using the automatically created start menu entry for the Python interpreter, you might want to start Python in the command prompt. As of -Python 3.3, the installer has an option to set that up for you. +Python 3.3, the installer has an option to set that up for you. -At the "Customize Python 3.3" screen, an option called +At the "Customize Python 3.4" screen, an option called "Add python.exe to search path" can be enabled to have the installer place your installation into the :envvar:`%PATH%`. This allows you to type :command:`python` to run the interpreter. Thus, you can also execute your scripts with command line options, see :ref:`using-on-cmdline` documentation. If you don't enable this option at install time, you can always re-run the -installer to choose it. - -The alternative is manually modifying the :envvar:`%PATH%` using the -directions in :ref:`setting-envvars`. You need to set your :envvar:`%PATH%` -environment variable to include the directory of your Python distribution, -delimited by a semicolon from other entries. An example variable could look -like this (assuming the first two entries are Windows' default):: - - C:\WINDOWS\system32;C:\WINDOWS;C:\Python33 - +installer to choose it. The alternative is manually modifying the :envvar:`%PATH%`. See the +FAQ:ref:`_running-windows:`. Finding modules --------------- @@ -235,7 +187,7 @@ setting this through the usual facilities, for example (might require administrative rights): -#. Launch a command prompt. +#. Launch a command prompt with administrator rights. #. Associate the correct file group with ``.py`` scripts:: assoc .py=Python.File @@ -589,6 +541,16 @@ by Trent Apted et al, 2007 + +Using Visual Studio +=================== + +`Python Tools for Visual Studio `_ is an add-on +for Visual Studio published by Microsoft that turns Visual Studio into a full- +featured Python IDE. It is not compatible with Express editions of Visual +Studio. + + Other resources =============== @@ -604,5 +566,3 @@ :pep:`397` - Python launcher for Windows The proposal for the launcher to be included in the Python distribution. - -