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 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 give a complete pathname to it at a command (shell) prompt, or in the shell script (or .BAT file, shortcut target, etc.) that runs it.[1] On Windows, you can also use Start → Programs → Python 2.4 → Python (command line).
Environment Variables
Besides PATH, other environment variables affect the python program. Some environment variables have the same effects as options passed to python on the command line, as documented in the next section. A few environment variables provide settings not available via command-line options:
PYTHONHOMEThe Python installation directory. A lib subdirectory, containing the standard Python library modules, should exist under this directory. On Unix-like systems, the standard library modules should be in subdirectory lib/python-2.3 for Python 2.3, lib/python-2.4 for Python 2.4, and so on.
PYTHONPATHA list of directories separated by colons on Unix-like systems and by semicolons on Windows. Modules are imported from these directories. This list extends the initial value for Python’s
sys.pathvariable. Modules, importing, and thesys.pathvariable are covered in Chapter 7 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access