Environment Variables
Environment variables are system-wide settings that span programs and are used for global configuration.
Operational Variables
PYTHONPATH
Augments the default search path for imported module files. The format is the same as the shellâs
PATH
setting: directory pathnames separated by colons (semicolons on Windows). On module imports, Python searches for the corresponding file or directory in each listed directory, from left to right. Merged intosys.path
.PYTHONSTARTUP
If set to the name of a readable file, the Python commands in that file are executed before the first prompt is displayed in interactive mode.
PYTHONHOME
If set, the value is used as an alternate prefix directory for library modules (or
sys.prefix
,sys.exec_prefix
). The default module search path usessys.prefix/lib
.PYTHONCASEOK
If set, ignores case in import statements (on Windows).
PYTHONIOENCODING
encodingname
[:
errorhandler
] override used forstdin
,stdout
, andstderr
streams.
Command-Line Option Variables
PYTHONDEBUG
If nonempty, same as
-d
option.PYTHONDONTWRITEBYTECODE
If nonempty, same as
-B
option.PYTHONINSPECT
If nonempty, same as
-i
option.PYTHONNOUSERSITE
If nonempty, same as
-s
option.PYTHONOPTIMIZE
If nonempty, same as
-O
option.PYTHONUNBUFFERED
If nonempty, same as
-u
option.PYTHONVERBOSE
If nonempty, same as
-v
option.
Get Python Pocket Reference, 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.