diff -r fbdaca8bf3f5 Doc/faq/windows.rst --- a/Doc/faq/windows.rst Wed Mar 12 15:09:00 2014 -0500 +++ b/Doc/faq/windows.rst Thu Mar 13 00:15:28 2014 -0500 @@ -13,6 +13,7 @@ .. XXX need review for Python 3. XXX need review for Windows Vista/Seven? +.. _running-windows: How do I run a Python program under Windows? -------------------------------------------- @@ -37,7 +38,8 @@ *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 +Programs --> Accessories --> Command Prompt`; under Windows 8 right click the +Windows Icon or type Command Prompt at the Start Menu. 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:: @@ -114,7 +116,7 @@ then you need to make sure that your computer knows where to find the Python interpreter. To do this you will have to modify a setting called PATH, which is -a list of directories where Windows will look for programs. +a list of directories where Windows will look for programs. You should arrange for Python's installation directory to be added to the PATH of every command window as it starts. If you installed Python fairly recently @@ -137,8 +139,8 @@ 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. +More information about environment variables and path can be found +:ref:`below` . How do I make Python scripts executable? ---------------------------------------- @@ -342,3 +344,81 @@ able to handle it. (If your copy of WinZip doesn't, get a newer one from http://www.winzip.com.) +.. sectionauthor:: Kathleen Weaver +.. moved from using windows + +.. _setting-envvars: + +How do I Change Enviroment Settings? +------------------------------------ + +To change environment variables in Windows 7 and 8, you must use the built-in dialog. + +Windows has a built-in dialog for changing environment variables + + Windows XP: 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` + + Windows 7: Right-click the Windows Icon, choose :menuselection:`Contol Panel`. + Then click :guilabel:`System` and click the :guilabel:`Advanced system settings` + and click the :guilabel:`Environment Variables` button. + + In short, your path is: + + :menuselection:`Control Panel + --> System + --> Advanced system settings + --> Environment Variables` + + Windows 8: Right-click the Windows Icon, choose + :menuselection:`System` and click the :guilabel:`Advanced system settings` and click + the :guilabel:`Environment Variables` button. (Windows 8 skips the control panel) + + In short, your path is: + + :menuselection:`System + --> Advanced system settings + --> 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 in versions prior to Windows 7 and 8 +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 in all Windows versions 8.1 and below 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 + diff -r fbdaca8bf3f5 Doc/using/windows.rst --- a/Doc/using/windows.rst Wed Mar 12 15:09:00 2014 -0500 +++ b/Doc/using/windows.rst Thu Mar 13 00:15:28 2014 -0500 @@ -20,22 +20,33 @@ has compiled Windows installers (MSI packages) with every `release `_ for many years. +.. sectionauthor:: Kathleen Weaver + +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) - suitable for creating and running Python Scripts along with being a command line interpreter + * Python (command line) - Python command line interpreter + * Python Manuals - Python documentation + * Uninstall Python - which will uninstall these programs. + +.. sectionauthor:: Robert Lehmann + +All versions can be installed and will run independently. The Windows command +prompt typically runs the last installed version of Python. + 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. -.. seealso:: +.. see also:: `Python on XP `_ "7 Minutes to "Hello World!"" @@ -49,7 +60,7 @@ `For Windows users `_ in "Installing Python" - in "`A Byte of Python `_" + in "`A Byte of Python `_" by Swaroop C H, 2003 @@ -69,66 +80,33 @@ Notice that these packages are likely to install *older* versions of Python. +.. sectionauthor:: Kathleen Weaver +Running Python +============== -Configuring Python -================== +The following shortcuts are creating during installation and can be used to run Python: -In order to run Python flawlessly, you might have to change certain environment -settings in Windows. +* Python (command line) - Python command line interpreter +* IDLE (Python GUI) - suitable for creating and running Python Scripts along with being a command line interpreter +* Select Python through File Explorer - this works the same as running the Python shortcut. + 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 Windows Command line and set environment variables. +Directions for setting environments are located at :ref:`setting-envvars`. +Detailed directions for running Python are at :ref:`running-windows`. -.. _setting-envvars: -Excursus: Setting environment variables ---------------------------------------- +Python scripts are associated with Python and will run when opened, but the +window will close immediately, usually faster than the user can read. A work +around is to add:: -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. + raw_input() -In short, your path is: +to the end of the script. The window will remain open until the user hits the enter key. - :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: +.. sectionauthor:: Robert Lehmann Finding the Python executable ----------------------------- @@ -231,7 +209,7 @@ setting this through the usual facilities, for example (might require administrative rights): -#. Launch a command prompt. +#. Launch a command prompt [Windows 8 - Launch Command Prompt (Admin)] #. Associate the correct file group with ``.py`` scripts:: assoc .py=Python.File @@ -240,7 +218,6 @@ ftype Python.File=C:\Path\to\pythonw.exe "%1" %* - .. _launcher: Python Launcher for Windows