Debian Codegraph @

upstream/opensuse-tumbleweed/man1/python3.14.1

raw
1 .TH PYTHON "1"
2
3 .\" To view this file while editing, run it through groff:
4 .\" groff -Tascii -man python.man | less
5
6 .SH NAME
7 python \- an interpreted, interactive, object-oriented programming language
8 .SH SYNOPSIS
9 .B python
10 [
11 .B \-B
12 ]
13 [
14 .B \-b
15 ]
16 [
17 .B \-d
18 ]
19 [
20 .B \-E
21 ]
22 [
23 .B \-h
24 ]
25 [
26 .B \-i
27 ]
28 [
29 .B \-I
30 ]
31 .br
32 [
33 .B \-m
34 .I module-name
35 ]
36 [
37 .B \-q
38 ]
39 [
40 .B \-R
41 ]
42 [
43 .B \-O
44 ]
45 [
46 .B \-OO
47 ]
48 [
49 .B \-P
50 ]
51 [
52 .B \-s
53 ]
54 [
55 .B \-S
56 ]
57 [
58 .B \-u
59 ]
60 .br
61 [
62 .B \-v
63 ]
64 [
65 .B \-V
66 ]
67 [
68 .B \-W
69 .I argument
70 ]
71 [
72 .B \-x
73 ]
74 [
75 .B \-X
76 .I option
77 ]
78 [
79 .B \-?
80 ]
81 .br
82 [
83 .B \-\-check-hash-based-pycs
84 .I default
85 |
86 .I always
87 |
88 .I never
89 ]
90 .br
91 [
92 .B \-\-help
93 ]
94 [
95 .B \-\-help\-env
96 ]
97 [
98 .B \-\-help\-xoptions
99 ]
100 [
101 .B \-\-help\-all
102 ]
103 .br
104 [
105 .B \-c
106 .I command
107 |
108 .I script
109 |
110 \-
111 ]
112 [
113 .I arguments
114 ]
115 .SH DESCRIPTION
116 Python is an interpreted, interactive, object-oriented programming
117 language that combines remarkable power with very clear syntax.
118 For an introduction to programming in Python, see the Python Tutorial.
119 The Python Library Reference documents built-in and standard types,
120 constants, functions and modules.
121 Finally, the Python Reference Manual describes the syntax and
122 semantics of the core language in (perhaps too) much detail.
123 (These documents may be located via the
124 .B "INTERNET RESOURCES"
125 below; they may be installed on your system as well.)
126 .PP
127 Python's basic power can be extended with your own modules written in
128 C or C++.
129 On most systems such modules may be dynamically loaded.
130 Python is also adaptable as an extension language for existing
131 applications.
132 See the internal documentation for hints.
133 .PP
134 Documentation for installed Python modules and packages can be
135 viewed by running the
136 .B pydoc
137 program.
138 .SH COMMAND LINE OPTIONS
139 .TP
140 .B \-B
141 Don't write
142 .I .pyc
143 files on import. See also PYTHONDONTWRITEBYTECODE.
144 .TP
145 .B \-b
146 Issue warnings about str(bytes_instance), str(bytearray_instance)
147 and comparing bytes/bytearray with str. (\-bb: issue errors)
148 .TP
149 .BI "\-c " command
150 Specify the command to execute (see next section).
151 This terminates the option list (following options are passed as
152 arguments to the command).
153 .TP
154 .BI "\-\-check\-hash\-based\-pycs " mode
155 Configure how Python evaluates the up-to-dateness of hash-based .pyc files.
156 .TP
157 .B \-d
158 Turn on parser debugging output (for expert only, depending on
159 compilation options).
160 .TP
161 .B \-E
162 Ignore environment variables like PYTHONPATH and PYTHONHOME that modify
163 the behavior of the interpreter.
164 .TP
165 .B \-h ", " \-? ", "\-\-help
166 Prints the usage for the interpreter executable and exits.
167 .TP
168 .B "\-\-help\-env"
169 Prints help about Python-specific environment variables and exits.
170 .TP
171 .B "\-\-help\-xoptions"
172 Prints help about implementation-specific \fB\-X\fP options and exits.
173 .TP
174 .TP
175 .B "\-\-help\-all"
176 Prints complete usage information and exits.
177 .TP
178 .B \-i
179 When a script is passed as first argument or the \fB\-c\fP option is
180 used, enter interactive mode after executing the script or the
181 command. It does not read the $PYTHONSTARTUP file. This can be
182 useful to inspect global variables or a stack trace when a script
183 raises an exception.
184 .TP
185 .B \-I
186 Run Python in isolated mode. This also implies \fB\-E\fP, \fB\-P\fP and \fB\-s\fP. In
187 isolated mode sys.path contains neither the script's directory nor the user's
188 site\-packages directory. All PYTHON* environment variables are ignored, too.
189 Further restrictions may be imposed to prevent the user from injecting
190 malicious code.
191 .TP
192 .BI "\-m " module-name
193 Searches
194 .I sys.path
195 for the named module and runs the corresponding
196 .I .py
197 file as a script. This terminates the option list (following options
198 are passed as arguments to the module).
199 .TP
200 .B \-O
201 Remove assert statements and any code conditional on the value of
202 __debug__; augment the filename for compiled (bytecode) files by
203 adding .opt-1 before the .pyc extension.
204 .TP
205 .B \-OO
206 Do \fB\-O\fP and also discard docstrings; change the filename for
207 compiled (bytecode) files by adding .opt-2 before the .pyc extension.
208 .TP
209 .B \-P
210 Don't automatically prepend a potentially unsafe path to \fBsys.path\fP such
211 as the current directory, the script's directory or an empty string. See also the
212 \fBPYTHONSAFEPATH\fP environment variable.
213 .TP
214 .B \-q
215 Do not print the version and copyright messages. These messages are
216 also suppressed in non-interactive mode.
217 .TP
218 .B \-R
219 Turn on hash randomization. This option only has an effect if the
220 \fBPYTHONHASHSEED\fR environment variable is set to \fB0\fR, since hash
221 randomization is enabled by default.
222 .TP
223 .B \-s
224 Don't add user site directory to sys.path.
225 .TP
226 .B \-S
227 Disable the import of the module
228 .I site
229 and the site-dependent manipulations of
230 .I sys.path
231 that it entails. Also disable these manipulations if
232 .I site
233 is explicitly imported later.
234 .TP
235 .B \-u
236 Force the stdout and stderr streams to be unbuffered.
237 This option has no effect on the stdin stream.
238 .TP
239 .B \-v
240 Print a message each time a module is initialized, showing the place
241 (filename or built-in module) from which it is loaded. When given
242 twice, print a message for each file that is checked for when
243 searching for a module. Also provides information on module cleanup
244 at exit.
245 .TP
246 .B \-V ", " \-\-version
247 Prints the Python version number of the executable and exits. When given
248 twice, print more information about the build.
249
250 .TP
251 .BI "\-W " argument
252 Warning control. Python's warning machinery by default prints warning messages
253 to
254 .IR sys.stderr .
255
256 The simplest settings apply a particular action unconditionally to all warnings
257 emitted by a process (even those that are otherwise ignored by default):
258
259 -Wdefault # Warn once per call location
260 -Werror # Convert to exceptions
261 -Walways # Warn every time
262 -Wall # Same as -Walways
263 -Wmodule # Warn once per calling module
264 -Wonce # Warn once per Python process
265 -Wignore # Never warn
266
267 The action names can be abbreviated as desired and the interpreter will resolve
268 them to the appropriate action name. For example,
269 .B \-Wi
270 is the same as
271 .B \-Wignore .
272
273 The full form of argument is:
274 .IB action:message:category:module:lineno
275
276 Empty fields match all values; trailing empty fields may be omitted. For
277 example
278 .B \-W ignore::DeprecationWarning
279 ignores all DeprecationWarning warnings.
280
281 The
282 .I action
283 field is as explained above but only applies to warnings that match
284 the remaining fields.
285
286 The
287 .I message
288 field must match the whole printed warning message; this match is
289 case-insensitive.
290
291 The
292 .I category
293 field matches the warning category (ex: "DeprecationWarning"). This must be a
294 class name; the match test whether the actual warning category of the message
295 is a subclass of the specified warning category.
296
297 The
298 .I module
299 field matches the (fully-qualified) module name; this match is case-sensitive.
300
301 The
302 .I lineno
303 field matches the line number, where zero matches all line numbers and is thus
304 equivalent to an omitted line number.
305
306 Multiple
307 .B \-W
308 options can be given; when a warning matches more than one option, the action
309 for the last matching option is performed. Invalid
310 .B \-W
311 options are ignored (though, a warning message is printed about invalid options
312 when the first warning is issued).
313
314 Warnings can also be controlled using the
315 .B PYTHONWARNINGS
316 environment variable and from within a Python program using the warnings
317 module. For example, the warnings.filterwarnings() function can be used to use
318 a regular expression on the warning message.
319
320 .TP
321 .BI "\-X " option
322 Set implementation-specific option. The following options are available:
323 .RS
324 .TP
325 \fB\-X cpu_count=\fIN\fR
326 Override the return value of \fIos.cpu_count()\fR.
327 \fB\-X cpu_count=default\fR cancels overriding.
328 See also \fBPYTHON_CPU_COUNT\fR.
329 .TP
330 \fB\-X dev\fR
331 Enable CPython's "development mode", introducing additional
332 runtime checks which are too expensive to be enabled by default. It
333 will not be more verbose than the default if the code is correct: new
334 warnings are only emitted when an issue is detected. Effect of the
335 developer mode:
336 .RS
337 .IP \(bu 2
338 Add default warning filter, as \fB\-W default\fR.
339 .IP \(bu 2
340 Install debug hooks on memory allocators: see the
341 PyMem_SetupDebugHooks() C function.
342 .IP \(bu 2
343 Enable the faulthandler module to dump the Python traceback on a crash.
344 .IP \(bu 2
345 Enable asyncio debug mode.
346 .IP \(bu 2
347 Set the dev_mode attribute of sys.flags to True.
348 .IP \(bu 2
349 io.IOBase destructor logs close() exceptions.
350 .RE
351 .TP
352 \fB\-X importtime\fR
353 Show how long each import takes. It shows module name,
354 cumulative time (including nested imports) and self time (excluding
355 nested imports). Note that its output may be broken in multi-threaded
356 application. Typical usage is
357 \fBpython3 \-X importtime \-c 'import asyncio'\fR.
358 .IP
359 \fB\-X importtime=2\fR enables additional output that indicates when an
360 imported module has already been loaded. In such cases, the string
361 \fBcached\fR will be printed in both time columns.
362 .TP
363 \fB\-X faulthandler\fR
364 Enable faulthandler.
365 .TP
366 \fB\-X frozen_modules=\fR[\fBon\fR|\fBoff\fR]
367 Whether or not frozen modules should be used.
368 The default is "on" (or "off" if you are running a local build).
369 .TP
370 \fB\-X gil=\fR[\fB0\fR|\fB1\fR]
371 Enable (1) or disable (0) the GIL. See also \fBPYTHON_GIL\fR.
372 Only available in builds configured with \fB\-\-disable\-gil\fR.
373 .TP
374 \fB\-X int_max_str_digits=\fInumber\fR
375 Limit the size of int<->str conversions.
376 This helps avoid denial of service attacks when parsing untrusted data.
377 The default is sys.int_info.default_max_str_digits. 0 disables.
378 .TP
379 \fB\-X no_debug_ranges\fR
380 Disable the inclusion of the tables mapping extra
381 location information (end line, start column offset and end column
382 offset) to every instruction in code objects. This is useful when
383 smaller code objects and pyc files are desired as well as suppressing
384 the extra visual location indicators when the interpreter displays
385 tracebacks.
386 .TP
387 \fB\-X perf\fR
388 Support the Linux "perf" profiler. See also \fBPYTHONPERFSUPPORT=1\fR.
389 .TP
390 \fB\-X perf_jit\fR
391 Support the Linux "perf" profiler with DWARF support.
392 See also \fBPYTHON_PERF_JIT_SUPPORT=1\fR.
393 .TP
394 \fB\-X presite=\fIMOD\fR
395 Import this module before site. See also \fBPYTHON_PRESITE\fR.
396 This only works on debug builds.
397 .TP
398 \fB\-X pycache_prefix=\fIPATH\fR
399 Enable writing .pyc files to a parallel
400 tree rooted at the given directory instead of to the code tree.
401 .TP
402 \fB\-X showrefcount\fR
403 Output the total reference count and number of used
404 memory blocks when the program finishes or after each statement in the
405 interactive interpreter. This only works on debug builds.
406 .TP
407 \fB\-X tracemalloc\fR
408 Start tracing Python memory allocations using the
409 tracemalloc module. By default, only the most recent frame is stored in a
410 traceback of a trace. Use \fB\-X tracemalloc=\fINFRAME\fR to start tracing with a
411 traceback limit of NFRAME frames.
412 .TP
413 \fB\-X utf8\fR
414 Enable UTF-8 mode for operating system interfaces,
415 overriding the default locale-aware mode. \fB\-X utf8=0\fR explicitly
416 disables UTF-8 mode (even when it would otherwise activate
417 automatically). See \fBPYTHONUTF8\fR for more details.
418 .TP
419 \fB\-X warn_default_encoding\fR
420 Enable opt-in EncodingWarning for 'encoding=None'.
421 .RE
422 .TP
423 .B \-x
424 Skip the first line of the source. This is intended for a DOS
425 specific hack only. Warning: the line numbers in error messages will
426 be off by one!
427 .SH INTERPRETER INTERFACE
428 The interpreter interface resembles that of the UNIX shell: when
429 called with standard input connected to a tty device, it prompts for
430 commands and executes them until an EOF is read; when called with a
431 file name argument or with a file as standard input, it reads and
432 executes a
433 .I script
434 from that file;
435 when called with
436 .B \-c
437 .IR command ,
438 it executes the Python statement(s) given as
439 .IR command .
440 Here
441 .I command
442 may contain multiple statements separated by newlines.
443 Leading whitespace is significant in Python statements!
444 In non-interactive mode, the entire input is parsed before it is
445 executed.
446 .PP
447 If available, the script name and additional arguments thereafter are
448 passed to the script in the Python variable
449 .IR sys.argv ,
450 which is a list of strings (you must first
451 .I import sys
452 to be able to access it).
453 If no script name is given,
454 .I sys.argv[0]
455 is an empty string; if
456 .B \-c
457 is used,
458 .I sys.argv[0]
459 contains the string
460 .I '\-c'.
461 Note that options interpreted by the Python interpreter itself
462 are not placed in
463 .IR sys.argv .
464 .PP
465 In interactive mode, the primary prompt is `>>>'; the second prompt
466 (which appears when a command is not complete) is `...'.
467 The prompts can be changed by assignment to
468 .I sys.ps1
469 or
470 .IR sys.ps2 .
471 The interpreter quits when it reads an EOF at a prompt.
472 When an unhandled exception occurs, a stack trace is printed and
473 control returns to the primary prompt; in non-interactive mode, the
474 interpreter exits after printing the stack trace.
475 The interrupt signal raises the
476 .I Keyboard\%Interrupt
477 exception; other UNIX signals are not caught (except that SIGPIPE is
478 sometimes ignored, in favor of the
479 .I IOError
480 exception). Error messages are written to stderr.
481 .SH FILES AND DIRECTORIES
482 These are subject to difference depending on local installation
483 conventions; ${prefix} and ${exec_prefix} are installation-dependent
484 and should be interpreted as for GNU software; they may be the same.
485 The default for both is \fI/usr/local\fP.
486 .IP \fI${exec_prefix}/bin/python\fP
487 Recommended location of the interpreter.
488 .PP
489 .I ${prefix}/lib/python<version>
490 .br
491 .I ${exec_prefix}/lib/python<version>
492 .RS
493 Recommended locations of the directories containing the standard
494 modules.
495 .RE
496 .PP
497 .I ${prefix}/include/python<version>
498 .br
499 .I ${exec_prefix}/include/python<version>
500 .RS
501 Recommended locations of the directories containing the include files
502 needed for developing Python extensions and embedding the
503 interpreter.
504 .RE
505 .SH ENVIRONMENT VARIABLES
506 .IP PYTHONASYNCIODEBUG
507 If this environment variable is set to a non-empty string, enable the debug
508 mode of the asyncio module.
509 .IP PYTHON_BASIC_REPL
510 If this variable is set to any value, the interpreter will not attempt to
511 load the Python-based REPL that requires curses and readline, and will instead
512 use the traditional parser-based REPL.
513 .IP PYTHONBREAKPOINT
514 If this environment variable is set to 0, it disables the default debugger. It
515 can be set to the callable of your debugger of choice.
516 .IP PYTHONCOERCECLOCALE
517 If set to the value 0, causes the main Python command line application to skip
518 coercing the legacy ASCII-based C and POSIX locales to a more capable UTF-8
519 based alternative.
520 .IP PYTHON_COLORS
521 If this variable is set to 1, the interpreter will colorize various kinds of
522 output. Setting it to 0 deactivates this behavior.
523 .IP PYTHON_CPU_COUNT
524 If this variable is set to a positive integer, it overrides the return
525 values of \fIos.cpu_count\fR and \fIos.process_cpu_count\fR.
526 .IP
527 See also the \fB\-X cpu_count\fR option.
528 .IP PYTHONDEBUG
529 If this is set to a non-empty string it is equivalent to specifying
530 the \fB\-d\fP option. If set to an integer, it is equivalent to
531 specifying \fB\-d\fP multiple times.
532 .IP PYTHONEXECUTABLE
533 If this environment variable is set,
534 .IB sys.argv[0]
535 will be set to its value instead of the value got through the C runtime. Only
536 works on Mac OS X.
537 .IP PYTHONFAULTHANDLER
538 If this environment variable is set to a non-empty string,
539 .IR faulthandler.enable()
540 is called at startup: install a handler for SIGSEGV, SIGFPE, SIGABRT, SIGBUS
541 and SIGILL signals to dump the Python traceback.
542 .IP
543 This is equivalent to the \fB\-X faulthandler\fP option.
544 .IP PYTHON_FROZEN_MODULES
545 If this variable is set to \fBon\fR or \fBoff\fR, it determines whether or not
546 frozen modules are ignored by the import machinery. A value of \fBon\fR means
547 they get imported and \fBoff\fR means they are ignored. The default is \fBon\fR
548 for non-debug builds (the normal case) and \fBoff\fR for debug builds.
549 .IP
550 See also the \fB\-X frozen_modules\fR option.
551 .IP PYTHON_GIL
552 If this variable is set to 1, the global interpreter lock (GIL) will be forced
553 on. Setting it to 0 forces the GIL off. Only available in builds configured
554 with \fB\-\-disable\-gil\fP.
555 .IP
556 This is equivalent to the \fB\-X gil\fR option.
557 .IP PYTHON_HISTORY
558 This environment variable can be used to set the location of a history file
559 (on Unix, it is \fI~/.python_history\fP by default).
560 .IP PYTHONNODEBUGRANGES
561 If this variable is set, it disables the inclusion of the tables mapping
562 extra location information (end line, start column offset and end column
563 offset) to every instruction in code objects. This is useful when smaller code
564 objects and pyc files are desired as well as suppressing the extra visual
565 location indicators when the interpreter displays tracebacks.
566 .IP PYTHONDONTWRITEBYTECODE
567 If this is set to a non-empty string it is equivalent to specifying
568 the \fB\-B\fP option (don't try to write
569 .I .pyc
570 files).
571 .IP PYTHONDEVMODE
572 If this environment variable is set to a non-empty string, enable Python's
573 "development mode", introducing additional runtime checks that are too
574 expensive to be enabled by default.
575 .IP
576 This is equivalent to the \fB\-X dev\fR option.
577 .IP PYTHONHASHSEED
578 If this variable is set to "random", a random value is used to seed the hashes
579 of str and bytes objects.
580
581 If PYTHONHASHSEED is set to an integer value, it is used as a fixed seed for
582 generating the hash() of the types covered by the hash randomization. Its
583 purpose is to allow repeatable hashing, such as for selftests for the
584 interpreter itself, or to allow a cluster of python processes to share hash
585 values.
586
587 The integer must be a decimal number in the range [0,4294967295]. Specifying
588 the value 0 will disable hash randomization.
589 .IP PYTHONHOME
590 Change the location of the standard Python libraries. By default, the
591 libraries are searched in ${prefix}/lib/python<version> and
592 ${exec_prefix}/lib/python<version>, where ${prefix} and ${exec_prefix}
593 are installation-dependent directories, both defaulting to
594 \fI/usr/local\fP. When $PYTHONHOME is set to a single directory, its value
595 replaces both ${prefix} and ${exec_prefix}. To specify different values
596 for these, set $PYTHONHOME to ${prefix}:${exec_prefix}.
597 .IP PYTHONINSPECT
598 If this is set to a non-empty string it is equivalent to specifying
599 the \fB\-i\fP option.
600 .IP PYTHONINTMAXSTRDIGITS
601 Limit the maximum digit characters in an int value
602 when converting from a string and when converting an int back to a str.
603 A value of 0 disables the limit. Conversions to or from bases 2, 4, 8,
604 16, and 32 are never limited.
605 .IP
606 This is equivalent to the \fB\-X int_max_str_digits=\fINUMBER\fR option.
607 .IP PYTHONIOENCODING
608 If this is set before running the interpreter, it overrides the encoding used
609 for stdin/stdout/stderr, in the syntax
610 .IB encodingname ":" errorhandler
611 The
612 .IB errorhandler
613 part is optional and has the same meaning as in str.encode. For stderr, the
614 .IB errorhandler
615 part is ignored; the handler will always be \'backslashreplace\'.
616 .IP PYTHONMALLOC
617 Set the Python memory allocators and/or install debug hooks. The available
618 memory allocators are
619 .IR malloc
620 and
621 .IR pymalloc .
622 The available debug hooks are
623 .IR debug ,
624 .IR malloc_debug ,
625 and
626 .IR pymalloc_debug .
627 .IP
628 When Python is compiled in debug mode, the default is
629 .IR pymalloc_debug
630 and the debug hooks are automatically used. Otherwise, the default is
631 .IR pymalloc .
632 .IP PYTHONMALLOCSTATS
633 If set to a non-empty string, Python will print statistics of the pymalloc
634 memory allocator every time a new pymalloc object arena is created, and on
635 shutdown.
636 .IP
637 This variable is ignored if the
638 .RB $ PYTHONMALLOC
639 environment variable is used to force the
640 .BR malloc (3)
641 allocator of the C library, or if Python is configured without pymalloc support.
642 .IP PYTHONNOUSERSITE
643 If this is set to a non-empty string it is equivalent to specifying the
644 \fB\-s\fP option (Don't add the user site directory to sys.path).
645 .IP PYTHONOPTIMIZE
646 If this is set to a non-empty string it is equivalent to specifying
647 the \fB\-O\fP option. If set to an integer, it is equivalent to
648 specifying \fB\-O\fP multiple times.
649 .IP PYTHONPATH
650 Augments the default search path for module files.
651 The format is the same as the shell's $PATH: one or more directory
652 pathnames separated by colons.
653 Non-existent directories are silently ignored.
654 The default search path is installation dependent, but generally
655 begins with ${prefix}/lib/python<version> (see PYTHONHOME above).
656 The default search path is always appended to $PYTHONPATH.
657 If a script argument is given, the directory containing the script is
658 inserted in the path in front of $PYTHONPATH.
659 The search path can be manipulated from within a Python program as the
660 variable
661 .IR sys.path .
662 .IP PYTHON_PERF_JIT_SUPPORT
663 If this variable is set to a nonzero value, it enables support for
664 the Linux perf profiler so Python calls can be detected by it using DWARF
665 information.
666 Setting to 0 disables.
667 .IP
668 See also the \fB\-X perf_jit\fR option.
669 .IP PYTHONPERFSUPPORT
670 If this variable is set to a nonzero value, it enables support for
671 the Linux perf profiler so Python calls can be detected by it.
672 Setting to 0 disables.
673 .IP
674 See also the \fB\-X perf\fR option.
675 .IP PYTHONPLATLIBDIR
676 Override sys.platlibdir.
677 .IP PYTHONPROFILEIMPORTTIME
678 If this environment variable is set to \fB1\fR, Python will show
679 how long each import takes. If set to \fB2\fR, Python will include output for
680 imported modules that have already been loaded.
681 This is exactly equivalent to setting \fB\-X importtime\fP on the command line.
682 .IP PYTHONPYCACHEPREFIX
683 If this is set, Python will write \fB.pyc\fR files in a mirror directory tree
684 at this path, instead of in \fB__pycache__\fR directories within the source
685 tree.
686 .IP
687 This is equivalent to specifying the \fB\-X pycache_prefix=\fIPATH\fR option.
688 .IP PYTHONSAFEPATH
689 If this is set to a non-empty string, don't automatically prepend a potentially
690 unsafe path to \fBsys.path\fP such as the current directory, the script's
691 directory or an empty string. See also the \fB\-P\fP option.
692 .IP PYTHONSTARTUP
693 If this is the name of a readable file, the Python commands in that
694 file are executed before the first prompt is displayed in interactive
695 mode.
696 The file is executed in the same name space where interactive commands
697 are executed so that objects defined or imported in it can be used
698 without qualification in the interactive session.
699 You can also change the prompts
700 .I sys.ps1
701 and
702 .I sys.ps2
703 in this file.
704 .IP PYTHONTRACEMALLOC
705 If this environment variable is set to a non-empty string, start tracing
706 Python memory allocations using the tracemalloc module.
707 .IP
708 The value of the variable is the maximum number of frames stored in a
709 traceback of a trace. For example,
710 .IB PYTHONTRACEMALLOC=1
711 stores only the most recent frame.
712 .IP PYTHONUNBUFFERED
713 If this is set to a non-empty string it is equivalent to specifying
714 the \fB\-u\fP option.
715 .IP PYTHONUSERBASE
716 Defines the user base directory, which is used to compute the path of the user
717 .IR site\-packages
718 directory and installation paths for
719 .IR "python \-m pip install \-\-user" .
720 .IP PYTHONUTF8
721 If set to 1, enable the Python "UTF-8 Mode". Setting to 0 disables.
722 .IP PYTHONVERBOSE
723 If this is set to a non-empty string it is equivalent to specifying
724 the \fB\-v\fP option. If set to an integer, it is equivalent to
725 specifying \fB\-v\fP multiple times.
726 .IP PYTHONWARNDEFAULTENCODING
727 If this environment variable is set to a non-empty string, issue a
728 \fIEncodingWarning\fR when the locale-specific default encoding is used.
729 .IP PYTHONWARNINGS
730 If this is set to a comma-separated string it is equivalent to
731 specifying the \fB\-W\fP option for each separate value.
732 .SS Debug-mode variables
733 Setting these variables only has an effect in a debug build of Python, that is,
734 if Python was configured with the
735 \fB\-\-with\-pydebug\fP build option.
736 .IP PYTHONDUMPREFS
737 If this environment variable is set, Python will dump objects and reference
738 counts still alive after shutting down the interpreter.
739 .IP PYTHONDUMPREFSFILE
740 If set, Python will dump objects and reference counts still alive after
741 shutting down the interpreter into a file under the path given as the value to
742 this environment variable.
743 .IP PYTHON_PRESITE
744 If this variable is set to a module, that module will be imported
745 early in the interpreter lifecycle, before the \fIsite\fR module is
746 executed, and before the \fI__main__\fR module is created.
747 This only works on debug builds.
748 .IP
749 This is equivalent to the \fB\-X presite=\fImodule\fR option.
750 .SH AUTHOR
751 The Python Software Foundation: https://www.python.org/psf/
752 .SH INTERNET RESOURCES
753 Main website: https://www.python.org/
754 .br
755 Documentation: https://docs.python.org/
756 .br
757 Developer resources: https://devguide.python.org/
758 .br
759 Downloads: https://www.python.org/downloads/
760 .br
761 Module repository: https://pypi.org/
762 .br
763 Newsgroups: comp.lang.python, comp.lang.python.announce
764 .SH LICENSING
765 Python is distributed under an Open Source license. See the file
766 "LICENSE" in the Python source distribution for information on terms &
767 conditions for accessing and otherwise using Python and for a
768 DISCLAIMER OF ALL WARRANTIES.