Environment Variables
Environment variables are system-wide settings that span programs and are used for global configuration.
Operational Variables
PYTHONPATHAugments the default search path for imported module files. The format is the same as the shell’s
PATHsetting: 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.PYTHONSTARTUPIf 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.
PYTHONHOMEIf 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.PYTHONCASEOKIf set, ignores case in import statements (on Windows).
PYTHONIOENCODINGencodingname[:errorhandler] override used forstdin,stdout, andstderrstreams.
Command-Line Option Variables
PYTHONDEBUGIf nonempty, same as
-doption.PYTHONDONTWRITEBYTECODEIf nonempty, same as
-Boption.PYTHONINSPECTIf nonempty, same as
-ioption.PYTHONNOUSERSITEIf nonempty, same as
-soption.PYTHONOPTIMIZEIf nonempty, same as
-Ooption.PYTHONUNBUFFEREDIf nonempty, same as
-uoption.PYTHONVERBOSEIf nonempty, same as
-voption.
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