Skip to content

Commit b18da56

Browse files
committed
bpo-32613: In Windows FAQ use py command instead of python.
1 parent ebac278 commit b18da56

File tree

3 files changed

+26
-57
lines changed

3 files changed

+26
-57
lines changed

Doc/faq/windows.rst

Lines changed: 23 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ obvious; otherwise, you might need a little more guidance.
2424
Unless you use some sort of integrated development environment, you will end up
2525
*typing* Windows commands into what is variously referred to as a "DOS window"
2626
or "Command prompt window". Usually you can create such a window from your
27-
Start menu; under Windows 7 the menu selection is :menuselection:`Start -->
28-
Programs --> Accessories --> Command Prompt`. You should be able to recognize
27+
search bar by searching for ``cmd``. You should be able to recognize
2928
when you have started such a window because you will see a Windows "command
3029
prompt", which usually looks like this::
3130

@@ -46,15 +45,15 @@ compiles it into bytecodes, and then executes the bytecodes to run your
4645
program. So, how do you arrange for the interpreter to handle your Python?
4746

4847
First, you need to make sure that your command window recognises the word
49-
"python" as an instruction to start the interpreter. If you have opened a
50-
command window, you should try entering the command ``python`` and hitting
48+
"py" as an instruction to start the interpreter. If you have opened a
49+
command window, you should try entering the command ``py`` and hitting
5150
return::
5251

53-
C:\Users\YourName> python
52+
C:\Users\YourName> py
5453

5554
You should then see something like::
5655

57-
Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit (Intel)] on win32
56+
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32
5857
Type "help", "copyright", "credits" or "license" for more information.
5958
>>>
6059

@@ -69,64 +68,33 @@ by entering a few expressions of your choice and seeing the results::
6968
'HelloHelloHello'
7069

7170
Many people use the interactive mode as a convenient yet highly programmable
72-
calculator. When you want to end your interactive Python session, hold the :kbd:`Ctrl`
73-
key down while you enter a :kbd:`Z`, then hit the ":kbd:`Enter`" key to get back to your
74-
Windows command prompt.
71+
calculator. When you want to end your interactive Python session,
72+
call the ``exit()`` function or hold the :kbd:`Ctrl` key down
73+
while you enter a :kbd:`Z`, then hit the ":kbd:`Enter`" key to get
74+
back to your Windows command prompt.
7575

7676
You may also find that you have a Start-menu entry such as :menuselection:`Start
77-
--> Programs --> Python 3.3 --> Python (command line)` that results in you
77+
--> Programs --> Python 3.6 --> Python (command line)` that results in you
7878
seeing the ``>>>`` prompt in a new window. If so, the window will disappear
79-
after you enter the :kbd:`Ctrl-Z` character; Windows is running a single "python"
79+
after you call the ``exit()`` function or enter the :kbd:`Ctrl-Z`
80+
character; Windows is running a single "python"
8081
command in the window, and closes it when you terminate the interpreter.
8182

82-
If the ``python`` command, instead of displaying the interpreter prompt ``>>>``,
83-
gives you a message like::
83+
Now that we know the ``py`` command is recognized, you can give your
84+
Python script to it. You'll have to give either an absolute or a
85+
relative path to the Python script. Let's say your Python script is
86+
located in your desktop and is named ``hello.py``, and your command
87+
prompt is nicely opened in your home directory so you're seeing something
88+
similar to::
8489

85-
'python' is not recognized as an internal or external command, operable program or batch file.
90+
C:\Users\YourName>
8691

87-
.. sidebar:: |Adding Python to DOS Path|_
88-
:subtitle: `Adding Python to DOS Path`_
92+
So now you'll ask the ``py`` command to give your script to Python by
93+
typing ``py`` followed by your script path::
8994

90-
Python is not added to the DOS path by default. This screencast will walk
91-
you through the steps to add the correct entry to the `System Path`, allowing
92-
Python to be executed from the command-line by all users.
95+
C:\Users\YourName> py Desktop\hello.py
96+
hello
9397

94-
.. |Adding Python to DOS Path| image:: python-video-icon.png
95-
.. _`Adding Python to DOS Path`:
96-
http://showmedo.com/videotutorials/video?name=960000&fromSeriesID=96
97-
98-
99-
or::
100-
101-
Bad command or filename
102-
103-
then you need to make sure that your computer knows where to find the Python
104-
interpreter. To do this you will have to modify a setting called PATH, which is
105-
a list of directories where Windows will look for programs.
106-
107-
You should arrange for Python's installation directory to be added to the PATH
108-
of every command window as it starts. If you installed Python fairly recently
109-
then the command ::
110-
111-
dir C:\py*
112-
113-
will probably tell you where it is installed; the usual location is something
114-
like ``C:\Python33``. Otherwise you will be reduced to a search of your whole
115-
disk ... use :menuselection:`Tools --> Find` or hit the :guilabel:`Search`
116-
button and look for "python.exe". Supposing you discover that Python is
117-
installed in the ``C:\Python33`` directory (the default at the time of writing),
118-
you should make sure that entering the command ::
119-
120-
c:\Python33\python
121-
122-
starts up the interpreter as above (and don't forget you'll need a ":kbd:`Ctrl-Z`" and
123-
an ":kbd:`Enter`" to get out of it). Once you have verified the directory, you can
124-
add it to the system path to make it easier to start Python by just running
125-
the ``python`` command. This is currently an option in the installer as of
126-
CPython 3.3.
127-
128-
More information about environment variables can be found on the
129-
:ref:`Using Python on Windows <setting-envvars>` page.
13098

13199
How do I make Python scripts executable?
132100
----------------------------------------
@@ -330,4 +298,3 @@ This is a mistake; the extension should be .TGZ.
330298
Simply rename the downloaded file to have the .TGZ extension, and WinZip will be
331299
able to handle it. (If your copy of WinZip doesn't, get a newer one from
332300
https://www.winzip.com.)
333-

Doc/tools/susp-ignored.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ faq/programming,,:chr,">=4.0) or 1+f(xc,yc,x*x-y*y+xc,2.0*x*y+yc,k-1,f):f(xc,yc,
1414
faq/programming,,::,for x in sequence[::-1]:
1515
faq/programming,,:reduce,"print((lambda Ru,Ro,Iu,Io,IM,Sx,Sy:reduce(lambda x,y:x+y,map(lambda y,"
1616
faq/programming,,:reduce,"Sx=Sx,Sy=Sy:reduce(lambda x,y:x+y,map(lambda x,xc=Ru,yc=yc,Ru=Ru,Ro=Ro,"
17-
faq/windows,,:bd8afb90ebf2,"Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit (Intel)] on win32"
17+
faq/windows,,:d48eceb,"Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32"
1818
howto/cporting,,:encode,"if (!PyArg_ParseTuple(args, ""O:encode_object"", &myobj))"
1919
howto/cporting,,:say,"if (!PyArg_ParseTuple(args, ""U:say_hello"", &name))"
2020
howto/curses,,:black,"colors when it activates color mode. They are: 0:black, 1:red,"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Update the faq/windows.html to use the py command from PEP 397 instead of
2+
python.

0 commit comments

Comments
 (0)