Chapter 2. The Python Interpreter
To develop software systems in Python, you write text files that contain Python source code and documentation. You can use any text editor, including those in Integrated Development Environments (IDEs). You then process the source files with the Python compiler and interpreter. You can do this directly, or within an IDE, or via another program that embeds Python. The Python interpreter also lets you execute Python code interactively, as do IDEs.
The python Program
The Python interpreter program is run as python
(it’s named python.exe on Windows). python
includes both the interpreter itself and the Python compiler, which is implicitly invoked, as and if needed, on imported modules. Depending on your system, the program may typically have to be in a directory listed in your PATH
environment variable. Alternatively, as with any other program, you can give a complete pathname to it at a command (shell) prompt, or in the shell script (or shortcut target, etc.) that runs it.1
PEP 397
On Windows, since PEP 397, py.exe, the launcher, installs in the system area of Windows and is therefore guaranteed—barring deliberate further manipulation on your part—to be always on the PATH.
On Windows, press the Windows key and start typing python
: “Python 3.5 (command-line)” (if you have installed v3) appears, along with other choices, such as “IDLE (Python GUI).” Alternatively, if you have the py.exe launcher installed (that’s automatic with v3; with v2, you need ...
Get Python in a Nutshell, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.