Chapter 2. The Python Interpreter
To develop software systems in Python, you usually write text files that contain Python source code. You can do this using any text editor, including those we list in “Python Development Environments”. Then you process the source files with the Python compiler and interpreter. You can do this directly, within an integrated development environment (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). The program includes both the interpreter itself and the Python compiler, which is implicitly invoked as needed on imported modules. Depending on your system, the program may have to be in a directory listed in your PATH environment variable. Alternatively, as with any other program, you can provide its complete pathname at a command (shell) prompt or in the shell script (or shortcut target, etc.) that runs it.1
On Windows, press the Windows key and start typing python. “Python 3.x” (the command-line version) appears, along with other choices, such as “IDLE” (the Python GUI).
Environment Variables
Besides PATH, other environment variables affect the python program. Some of these have the same effects as options passed to python on the command line, as we show in the next section, but several environment variables provide settings not available via command-line options. ...
Get Python in a Nutshell, 4th 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.