blob: 225376574a26a96af7c568072184e96e1dfa7174 [file] [log] [blame]
Benjamin Petersonb9869df2016-03-21 22:31:02 -07001.TH PYTHON "1"
Andrew M. Kuchling3afe4f32004-10-07 12:30:54 +00002
Benjamin Peterson5f28b7b2009-03-26 21:49:58 +00003.\" To view this file while editing, run it through groff:
4.\" groff -Tascii -man python.man | less
Andrew M. Kuchling3afe4f32004-10-07 12:30:54 +00005
Guido van Rossuma7925f11994-01-26 10:20:16 +00006.SH NAME
7python \- an interpreted, interactive, object-oriented programming language
8.SH SYNOPSIS
9.B python
10[
Matthias Klosec8b16f82010-01-31 16:14:37 +000011.B \-B
12]
13[
Senthil Kumarance3dd0b2013-06-19 22:19:46 -050014.B \-b
15]
16[
Guido van Rossuma7925f11994-01-26 10:20:16 +000017.B \-d
18]
19[
Guido van Rossumb674baf2001-09-05 18:55:34 +000020.B \-E
21]
22[
23.B \-h
24]
25[
Guido van Rossuma7925f11994-01-26 10:20:16 +000026.B \-i
27]
28[
Christian Heimesad73a9c2013-08-10 16:36:18 +020029.B \-I
Andrew M. Kuchling166e6252004-10-07 12:04:50 +000030]
Guido van Rossumb674baf2001-09-05 18:55:34 +000031.br
32 [
Christian Heimesad73a9c2013-08-10 16:36:18 +020033.B \-m
34.I module-name
35]
36[
Senthil Kumarance3dd0b2013-06-19 22:19:46 -050037.B \-q
38]
39[
Matthias Klosec8b16f82010-01-31 16:14:37 +000040.B \-O
41]
42[
R David Murray9c4f09d2011-05-01 11:13:56 -040043.B \-OO
Matthias Klosec8b16f82010-01-31 16:14:37 +000044]
45[
Matthias Klosec8b16f82010-01-31 16:14:37 +000046.B \-s
47]
48[
Guido van Rossumb674baf2001-09-05 18:55:34 +000049.B \-S
Neil Schemenauer7d4bb9f2001-07-23 16:30:27 +000050]
51[
Guido van Rossumef5bca31994-05-03 14:15:32 +000052.B \-u
Guido van Rossuma7925f11994-01-26 10:20:16 +000053]
Guido van Rossumb674baf2001-09-05 18:55:34 +000054.br
55 [
Guido van Rossuma7925f11994-01-26 10:20:16 +000056.B \-v
57]
Guido van Rossum07c44c71998-04-10 19:46:00 +000058[
Barry Warsaw64569372000-09-15 18:39:09 +000059.B \-V
60]
Guido van Rossum1378c322000-12-19 03:21:54 +000061[
62.B \-W
63.I argument
64]
Guido van Rossumb674baf2001-09-05 18:55:34 +000065[
66.B \-x
67]
Matthias Klosec8b16f82010-01-31 16:14:37 +000068[
Senthil Kumarance3dd0b2013-06-19 22:19:46 -050069[
70.B \-X
71.I option
72]
Matthias Klosec8b16f82010-01-31 16:14:37 +000073.B \-?
74]
Guido van Rossum4cf4de51997-09-08 04:06:15 +000075.br
76 [
Benjamin Peterson42aa93b2017-12-09 10:26:52 -080077.B \--check-hash-based-pycs
Miro Hrončok16323cb2019-02-25 01:50:29 +010078.I default
79|
80.I always
81|
82.I never
Benjamin Peterson42aa93b2017-12-09 10:26:52 -080083]
84.br
85 [
Guido van Rossuma7925f11994-01-26 10:20:16 +000086.B \-c
87.I command
88|
89.I script
90|
91\-
92]
93[
94.I arguments
95]
96.SH DESCRIPTION
97Python is an interpreted, interactive, object-oriented programming
98language that combines remarkable power with very clear syntax.
Benjamin Petersonb0335ee2015-04-29 18:00:44 -040099For an introduction to programming in Python, see the Python Tutorial.
Guido van Rossuma7925f11994-01-26 10:20:16 +0000100The Python Library Reference documents built-in and standard types,
101constants, functions and modules.
102Finally, the Python Reference Manual describes the syntax and
103semantics of the core language in (perhaps too) much detail.
Guido van Rossumf4a090d2000-09-01 20:36:34 +0000104(These documents may be located via the
105.B "INTERNET RESOURCES"
Fred Drake4c9be9d1999-08-20 13:10:20 +0000106below; they may be installed on your system as well.)
Guido van Rossuma7925f11994-01-26 10:20:16 +0000107.PP
108Python's basic power can be extended with your own modules written in
109C or C++.
Guido van Rossum74faed21996-07-30 19:27:05 +0000110On most systems such modules may be dynamically loaded.
Guido van Rossuma7925f11994-01-26 10:20:16 +0000111Python is also adaptable as an extension language for existing
112applications.
113See the internal documentation for hints.
Andrew M. Kuchling88717f42001-04-05 14:50:40 +0000114.PP
Brett Cannonf299abd2015-04-13 14:21:02 -0400115Documentation for installed Python modules and packages can be
116viewed by running the
Andrew M. Kuchling88717f42001-04-05 14:50:40 +0000117.B pydoc
Brett Cannonf299abd2015-04-13 14:21:02 -0400118program.
Guido van Rossuma7925f11994-01-26 10:20:16 +0000119.SH COMMAND LINE OPTIONS
120.TP
Matthias Klosec8b16f82010-01-31 16:14:37 +0000121.B \-B
122Don't write
Brett Cannon10a7dbd2016-10-21 12:15:14 -0700123.I .pyc
Matthias Klosec8b16f82010-01-31 16:14:37 +0000124files on import. See also PYTHONDONTWRITEBYTECODE.
125.TP
Senthil Kumarance3dd0b2013-06-19 22:19:46 -0500126.B \-b
127Issue warnings about str(bytes_instance), str(bytearray_instance)
128and comparing bytes/bytearray with str. (-bb: issue errors)
129.TP
Guido van Rossumb674baf2001-09-05 18:55:34 +0000130.BI "\-c " command
131Specify the command to execute (see next section).
132This terminates the option list (following options are passed as
133arguments to the command).
134.TP
Benjamin Peterson42aa93b2017-12-09 10:26:52 -0800135.BI "\-\-check-hash-based-pycs " mode
136Configure how Python evaluates the up-to-dateness of hash-based .pyc files.
137.TP
Guido van Rossuma7925f11994-01-26 10:20:16 +0000138.B \-d
Victor Stinner84c4b192017-11-24 22:30:27 +0100139Turn on parser debugging output (for expert only, depending on
Guido van Rossuma7925f11994-01-26 10:20:16 +0000140compilation options).
Guido van Rossum9f65ae01994-02-23 09:10:27 +0000141.TP
Guido van Rossumb674baf2001-09-05 18:55:34 +0000142.B \-E
143Ignore environment variables like PYTHONPATH and PYTHONHOME that modify
144the behavior of the interpreter.
145.TP
Matthias Klosec8b16f82010-01-31 16:14:37 +0000146.B \-h ", " \-? ", "\-\-help
Guido van Rossumb674baf2001-09-05 18:55:34 +0000147Prints the usage for the interpreter executable and exits.
148.TP
Guido van Rossuma7925f11994-01-26 10:20:16 +0000149.B \-i
150When a script is passed as first argument or the \fB\-c\fP option is
151used, enter interactive mode after executing the script or the
Guido van Rossum9f65ae01994-02-23 09:10:27 +0000152command. It does not read the $PYTHONSTARTUP file. This can be
153useful to inspect global variables or a stack trace when a script
154raises an exception.
Guido van Rossuma7925f11994-01-26 10:20:16 +0000155.TP
Christian Heimesad73a9c2013-08-10 16:36:18 +0200156.B \-I
Ned Deily64298ae2015-04-29 14:51:43 -0700157Run Python in isolated mode. This also implies \fB\-E\fP and \fB\-s\fP. In
Serhiy Storchaka225821c2015-12-18 13:05:04 +0200158isolated mode sys.path contains neither the script's directory nor the user's
Christian Heimesad73a9c2013-08-10 16:36:18 +0200159site-packages directory. All PYTHON* environment variables are ignored, too.
160Further restrictions may be imposed to prevent the user from injecting
161malicious code.
162.TP
Andrew M. Kuchling166e6252004-10-07 12:04:50 +0000163.BI "\-m " module-name
Brett Cannonf299abd2015-04-13 14:21:02 -0400164Searches
165.I sys.path
166for the named module and runs the corresponding
167.I .py
Andrew M. Kuchling166e6252004-10-07 12:04:50 +0000168file as a script.
169.TP
Guido van Rossum4cf4de51997-09-08 04:06:15 +0000170.B \-O
Cheryl Sabella186b6062018-02-24 22:04:40 -0500171Remove assert statements and any code conditional on the value of
172__debug__; augment the filename for compiled (bytecode) files by
173adding .opt-1 before the .pyc extension.
Guido van Rossum4cf4de51997-09-08 04:06:15 +0000174.TP
R David Murray9c4f09d2011-05-01 11:13:56 -0400175.B \-OO
Cheryl Sabella186b6062018-02-24 22:04:40 -0500176Do \fB-O\fP and also discard docstrings; change the filename for
177compiled (bytecode) files by adding .opt-2 before the .pyc extension.
Matthias Klosec8b16f82010-01-31 16:14:37 +0000178.TP
Georg Brandl9d871192010-12-04 10:47:18 +0000179.B \-q
Brett Cannonf299abd2015-04-13 14:21:02 -0400180Do not print the version and copyright messages. These messages are
Georg Brandl9d871192010-12-04 10:47:18 +0000181also suppressed in non-interactive mode.
182.TP
Matthias Klosec8b16f82010-01-31 16:14:37 +0000183.B \-s
184Don't add user site directory to sys.path.
185.TP
Guido van Rossum4cf4de51997-09-08 04:06:15 +0000186.B \-S
187Disable the import of the module
188.I site
189and the site-dependent manipulations of
190.I sys.path
Éric Araujoc09fca62011-03-23 02:06:24 +0100191that it entails. Also disable these manipulations if
192.I site
193is explicitly imported later.
Guido van Rossum4cf4de51997-09-08 04:06:15 +0000194.TP
Guido van Rossumef5bca31994-05-03 14:15:32 +0000195.B \-u
Berker Peksag7f580972017-10-13 15:16:31 +0300196Force the stdout and stderr streams to be unbuffered.
197This option has no effect on the stdin stream.
Guido van Rossuma7925f11994-01-26 10:20:16 +0000198.TP
199.B \-v
200Print a message each time a module is initialized, showing the place
Fred Drake4c9be9d1999-08-20 13:10:20 +0000201(filename or built-in module) from which it is loaded. When given
Brett Cannonf299abd2015-04-13 14:21:02 -0400202twice, print a message for each file that is checked for when
Fred Drake4c9be9d1999-08-20 13:10:20 +0000203searching for a module. Also provides information on module cleanup
204at exit.
Guido van Rossuma7925f11994-01-26 10:20:16 +0000205.TP
Matthias Klosec8b16f82010-01-31 16:14:37 +0000206.B \-V ", " \-\-version
INADA Naoki0e175a62016-11-21 20:57:14 +0900207Prints the Python version number of the executable and exits. When given
208twice, print more information about the build.
Barry Warsaw64569372000-09-15 18:39:09 +0000209.TP
Guido van Rossum1378c322000-12-19 03:21:54 +0000210.BI "\-W " argument
211Warning control. Python sometimes prints warning message to
212.IR sys.stderr .
213A typical warning message has the following form:
214.IB file ":" line ": " category ": " message.
215By default, each warning is printed once for each source line where it
216occurs. This option controls how often warnings are printed.
217Multiple
218.B \-W
219options may be given; when a warning matches more than one
220option, the action for the last matching option is performed.
221Invalid
222.B \-W
223options are ignored (a warning message is printed about invalid
224options when the first warning is issued). Warnings can also be
225controlled from within a Python program using the
226.I warnings
227module.
228
229The simplest form of
230.I argument
231is one of the following
232.I action
233strings (or a unique abbreviation):
234.B ignore
235to ignore all warnings;
236.B default
237to explicitly request the default behavior (printing each warning once
238per source line);
239.B all
240to print a warning each time it occurs (this may generate many
241messages if a warning is triggered repeatedly for the same source
Fred Drakebd2e3b02001-07-26 21:25:58 +0000242line, such as inside a loop);
Guido van Rossum1378c322000-12-19 03:21:54 +0000243.B module
Georg Brandleeb575f2009-06-24 06:42:05 +0000244to print each warning only the first time it occurs in each
Guido van Rossum1378c322000-12-19 03:21:54 +0000245module;
246.B once
247to print each warning only the first time it occurs in the program; or
248.B error
249to raise an exception instead of printing a warning message.
250
251The full form of
252.I argument
253is
254.IB action : message : category : module : line.
255Here,
256.I action
257is as explained above but only applies to messages that match the
258remaining fields. Empty fields match all values; trailing empty
259fields may be omitted. The
260.I message
261field matches the start of the warning message printed; this match is
262case-insensitive. The
263.I category
264field matches the warning category. This must be a class name; the
265match test whether the actual warning category of the message is a
266subclass of the specified warning category. The full class name must
267be given. The
268.I module
269field matches the (fully-qualified) module name; this match is
270case-sensitive. The
271.I line
272field matches the line number, where zero matches all line numbers and
273is thus equivalent to an omitted line number.
274.TP
Senthil Kumarance3dd0b2013-06-19 22:19:46 -0500275.BI "\-X " option
Pablo Galindo41f0ef62020-01-23 01:03:04 +0000276Set implementation specific option. The following options are available:
277
278 -X faulthandler: enable faulthandler
279
280 -X showrefcount: output the total reference count and number of used
281 memory blocks when the program finishes or after each statement in the
282 interactive interpreter. This only works on debug builds
283
284 -X tracemalloc: start tracing Python memory allocations using the
285 tracemalloc module. By default, only the most recent frame is stored in a
286 traceback of a trace. Use -X tracemalloc=NFRAME to start tracing with a
287 traceback limit of NFRAME frames
288
Pablo Galindo41f0ef62020-01-23 01:03:04 +0000289 -X importtime: show how long each import takes. It shows module name,
290 cumulative time (including nested imports) and self time (excluding
291 nested imports). Note that its output may be broken in multi-threaded
292 application. Typical usage is python3 -X importtime -c 'import asyncio'
293
Serhiy Storchaka58de1dd2020-09-09 03:28:02 +0300294 -X dev: enable CPython's "development mode", introducing additional runtime
Pablo Galindo41f0ef62020-01-23 01:03:04 +0000295 checks which are too expensive to be enabled by default. It will not be
296 more verbose than the default if the code is correct: new warnings are
297 only emitted when an issue is detected. Effect of the developer mode:
298 * Add default warning filter, as -W default
299 * Install debug hooks on memory allocators: see the PyMem_SetupDebugHooks() C function
300 * Enable the faulthandler module to dump the Python traceback on a crash
301 * Enable asyncio debug mode
302 * Set the dev_mode attribute of sys.flags to True
303 * io.IOBase destructor logs close() exceptions
304
305 -X utf8: enable UTF-8 mode for operating system interfaces, overriding the default
306 locale-aware mode. -X utf8=0 explicitly disables UTF-8 mode (even when it would
307 otherwise activate automatically). See PYTHONUTF8 for more details
308
309 -X pycache_prefix=PATH: enable writing .pyc files to a parallel tree rooted at the
310 given directory instead of to the code tree.
Senthil Kumarance3dd0b2013-06-19 22:19:46 -0500311.TP
Guido van Rossumb674baf2001-09-05 18:55:34 +0000312.B \-x
313Skip the first line of the source. This is intended for a DOS
314specific hack only. Warning: the line numbers in error messages will
315be off by one!
Guido van Rossuma7925f11994-01-26 10:20:16 +0000316.SH INTERPRETER INTERFACE
317The interpreter interface resembles that of the UNIX shell: when
318called with standard input connected to a tty device, it prompts for
319commands and executes them until an EOF is read; when called with a
320file name argument or with a file as standard input, it reads and
321executes a
322.I script
323from that file;
324when called with
325.B \-c
doko@ubuntu.comd8623e82012-06-20 13:16:31 +0200326.IR command ,
Guido van Rossuma7925f11994-01-26 10:20:16 +0000327it executes the Python statement(s) given as
doko@ubuntu.comd8623e82012-06-20 13:16:31 +0200328.IR command .
Guido van Rossuma7925f11994-01-26 10:20:16 +0000329Here
330.I command
331may contain multiple statements separated by newlines.
332Leading whitespace is significant in Python statements!
Matthias Klose31a58df2005-03-20 14:16:03 +0000333In non-interactive mode, the entire input is parsed before it is
Guido van Rossuma7925f11994-01-26 10:20:16 +0000334executed.
335.PP
336If available, the script name and additional arguments thereafter are
337passed to the script in the Python variable
doko@ubuntu.comd8623e82012-06-20 13:16:31 +0200338.IR sys.argv ,
Guido van Rossuma7925f11994-01-26 10:20:16 +0000339which is a list of strings (you must first
340.I import sys
341to be able to access it).
342If no script name is given,
Guido van Rossumf4a090d2000-09-01 20:36:34 +0000343.I sys.argv[0]
344is an empty string; if
Guido van Rossuma7925f11994-01-26 10:20:16 +0000345.B \-c
346is used,
347.I sys.argv[0]
348contains the string
349.I '-c'.
Guido van Rossum74faed21996-07-30 19:27:05 +0000350Note that options interpreted by the Python interpreter itself
Guido van Rossuma7925f11994-01-26 10:20:16 +0000351are not placed in
doko@ubuntu.comd8623e82012-06-20 13:16:31 +0200352.IR sys.argv .
Guido van Rossuma7925f11994-01-26 10:20:16 +0000353.PP
354In interactive mode, the primary prompt is `>>>'; the second prompt
355(which appears when a command is not complete) is `...'.
356The prompts can be changed by assignment to
357.I sys.ps1
358or
doko@ubuntu.comd8623e82012-06-20 13:16:31 +0200359.IR sys.ps2 .
Guido van Rossuma7925f11994-01-26 10:20:16 +0000360The interpreter quits when it reads an EOF at a prompt.
361When an unhandled exception occurs, a stack trace is printed and
362control returns to the primary prompt; in non-interactive mode, the
363interpreter exits after printing the stack trace.
364The interrupt signal raises the
365.I Keyboard\%Interrupt
366exception; other UNIX signals are not caught (except that SIGPIPE is
367sometimes ignored, in favor of the
368.I IOError
369exception). Error messages are written to stderr.
370.SH FILES AND DIRECTORIES
371These are subject to difference depending on local installation
Fred Drake4c9be9d1999-08-20 13:10:20 +0000372conventions; ${prefix} and ${exec_prefix} are installation-dependent
373and should be interpreted as for GNU software; they may be the same.
374The default for both is \fI/usr/local\fP.
375.IP \fI${exec_prefix}/bin/python\fP
Guido van Rossuma7925f11994-01-26 10:20:16 +0000376Recommended location of the interpreter.
Fred Drake4c9be9d1999-08-20 13:10:20 +0000377.PP
378.I ${prefix}/lib/python<version>
379.br
380.I ${exec_prefix}/lib/python<version>
381.RS
382Recommended locations of the directories containing the standard
383modules.
384.RE
385.PP
386.I ${prefix}/include/python<version>
387.br
388.I ${exec_prefix}/include/python<version>
389.RS
390Recommended locations of the directories containing the include files
391needed for developing Python extensions and embedding the
392interpreter.
393.RE
Guido van Rossuma7925f11994-01-26 10:20:16 +0000394.SH ENVIRONMENT VARIABLES
Guido van Rossum4cf4de51997-09-08 04:06:15 +0000395.IP PYTHONHOME
396Change the location of the standard Python libraries. By default, the
Fred Drake4c9be9d1999-08-20 13:10:20 +0000397libraries are searched in ${prefix}/lib/python<version> and
398${exec_prefix}/lib/python<version>, where ${prefix} and ${exec_prefix}
Guido van Rossum4cf4de51997-09-08 04:06:15 +0000399are installation-dependent directories, both defaulting to
Fred Drake4c9be9d1999-08-20 13:10:20 +0000400\fI/usr/local\fP. When $PYTHONHOME is set to a single directory, its value
401replaces both ${prefix} and ${exec_prefix}. To specify different values
402for these, set $PYTHONHOME to ${prefix}:${exec_prefix}.
Guido van Rossuma7925f11994-01-26 10:20:16 +0000403.IP PYTHONPATH
404Augments the default search path for module files.
405The format is the same as the shell's $PATH: one or more directory
406pathnames separated by colons.
Matthias Klose31a58df2005-03-20 14:16:03 +0000407Non-existent directories are silently ignored.
Guido van Rossum4cf4de51997-09-08 04:06:15 +0000408The default search path is installation dependent, but generally
Fred Drake4c9be9d1999-08-20 13:10:20 +0000409begins with ${prefix}/lib/python<version> (see PYTHONHOME above).
Guido van Rossum4cf4de51997-09-08 04:06:15 +0000410The default search path is always appended to $PYTHONPATH.
Guido van Rossum74faed21996-07-30 19:27:05 +0000411If a script argument is given, the directory containing the script is
412inserted in the path in front of $PYTHONPATH.
Guido van Rossuma7925f11994-01-26 10:20:16 +0000413The search path can be manipulated from within a Python program as the
414variable
doko@ubuntu.comd8623e82012-06-20 13:16:31 +0200415.IR sys.path .
Sandro Mani8f023a22020-06-08 17:28:11 +0200416.IP PYTHONPLATLIBDIR
417Override sys.platlibdir.
Guido van Rossuma7925f11994-01-26 10:20:16 +0000418.IP PYTHONSTARTUP
419If this is the name of a readable file, the Python commands in that
420file are executed before the first prompt is displayed in interactive
421mode.
422The file is executed in the same name space where interactive commands
423are executed so that objects defined or imported in it can be used
424without qualification in the interactive session.
425You can also change the prompts
426.I sys.ps1
427and
428.I sys.ps2
429in this file.
Guido van Rossum9abaf4d2001-10-12 22:17:56 +0000430.IP PYTHONOPTIMIZE
431If this is set to a non-empty string it is equivalent to specifying
432the \fB\-O\fP option. If set to an integer, it is equivalent to
433specifying \fB\-O\fP multiple times.
Guido van Rossuma7925f11994-01-26 10:20:16 +0000434.IP PYTHONDEBUG
435If this is set to a non-empty string it is equivalent to specifying
Guido van Rossum9abaf4d2001-10-12 22:17:56 +0000436the \fB\-d\fP option. If set to an integer, it is equivalent to
437specifying \fB\-d\fP multiple times.
Matthias Klosec8b16f82010-01-31 16:14:37 +0000438.IP PYTHONDONTWRITEBYTECODE
439If this is set to a non-empty string it is equivalent to specifying
440the \fB\-B\fP option (don't try to write
Brett Cannon10a7dbd2016-10-21 12:15:14 -0700441.I .pyc
Matthias Klosec8b16f82010-01-31 16:14:37 +0000442files).
Guido van Rossuma7925f11994-01-26 10:20:16 +0000443.IP PYTHONINSPECT
444If this is set to a non-empty string it is equivalent to specifying
445the \fB\-i\fP option.
Benjamin Petersonee85a1d2010-10-13 22:20:15 +0000446.IP PYTHONIOENCODING
447If this is set before running the interpreter, it overrides the encoding used
448for stdin/stdout/stderr, in the syntax
449.IB encodingname ":" errorhandler
450The
451.IB errorhandler
452part is optional and has the same meaning as in str.encode. For stderr, the
453.IB errorhandler
454 part is ignored; the handler will always be \'backslashreplace\'.
Matthias Klosec8b16f82010-01-31 16:14:37 +0000455.IP PYTHONNOUSERSITE
Benjamin Petersonee85a1d2010-10-13 22:20:15 +0000456If this is set to a non-empty string it is equivalent to specifying the
457\fB\-s\fP option (Don't add the user site directory to sys.path).
Guido van Rossumef5bca31994-05-03 14:15:32 +0000458.IP PYTHONUNBUFFERED
Guido van Rossuma7925f11994-01-26 10:20:16 +0000459If this is set to a non-empty string it is equivalent to specifying
Guido van Rossumef5bca31994-05-03 14:15:32 +0000460the \fB\-u\fP option.
Guido van Rossuma7925f11994-01-26 10:20:16 +0000461.IP PYTHONVERBOSE
462If this is set to a non-empty string it is equivalent to specifying
Guido van Rossum9abaf4d2001-10-12 22:17:56 +0000463the \fB\-v\fP option. If set to an integer, it is equivalent to
Brett Cannonf299abd2015-04-13 14:21:02 -0400464specifying \fB\-v\fP multiple times.
Philip Jenvey0805ca32010-04-07 04:04:10 +0000465.IP PYTHONWARNINGS
466If this is set to a comma-separated string it is equivalent to
467specifying the \fB\-W\fP option for each separate value.
Georg Brandl2daf6ae2012-02-20 19:54:16 +0100468.IP PYTHONHASHSEED
Benjamin Petersonc9f54cf2012-02-21 16:08:05 -0500469If this variable is set to "random", a random value is used to seed the hashes
Serhiy Storchakae9c90aa2019-08-24 12:49:27 +0300470of str and bytes objects.
Georg Brandl2daf6ae2012-02-20 19:54:16 +0100471
472If PYTHONHASHSEED is set to an integer value, it is used as a fixed seed for
473generating the hash() of the types covered by the hash randomization. Its
474purpose is to allow repeatable hashing, such as for selftests for the
475interpreter itself, or to allow a cluster of python processes to share hash
476values.
477
478The integer must be a decimal number in the range [0,4294967295]. Specifying
Benjamin Petersonc9f54cf2012-02-21 16:08:05 -0500479the value 0 will disable hash randomization.
Berker Peksag9863de02018-07-09 22:17:54 +0300480.IP PYTHONMALLOC
481Set the Python memory allocators and/or install debug hooks. The available
482memory allocators are
483.IR malloc
484and
485.IR pymalloc .
486The available debug hooks are
487.IR debug ,
488.IR malloc_debug ,
489and
490.IR pymalloc_debug .
491.IP
492When Python is compiled in debug mode, the default is
493.IR pymalloc_debug
494and the debug hooks are automatically used. Otherwise, the default is
495.IR pymalloc .
496.IP PYTHONMALLOCSTATS
497If set to a non-empty string, Python will print statistics of the pymalloc
498memory allocator every time a new pymalloc object arena is created, and on
499shutdown.
500.IP
501This variable is ignored if the
502.RB $ PYTHONMALLOC
503environment variable is used to force the
504.BR malloc (3)
505allocator of the C library, or if Python is configured without pymalloc support.
506.IP PYTHONASYNCIODEBUG
507If this environment variable is set to a non-empty string, enable the debug
508mode of the asyncio module.
509.IP PYTHONTRACEMALLOC
510If this environment variable is set to a non-empty string, start tracing
511Python memory allocations using the tracemalloc module.
512.IP
513The value of the variable is the maximum number of frames stored in a
514traceback of a trace. For example,
515.IB PYTHONTRACEMALLOC=1
516stores only the most recent frame.
517.IP PYTHONFAULTHANDLER
518If this environment variable is set to a non-empty string,
519.IR faulthandler.enable()
520is called at startup: install a handler for SIGSEGV, SIGFPE, SIGABRT, SIGBUS
521and SIGILL signals to dump the Python traceback.
522.IP
523This is equivalent to the \fB-X faulthandler\fP option.
524.IP PYTHONEXECUTABLE
525If this environment variable is set,
526.IB sys.argv[0]
527will be set to its value instead of the value got through the C runtime. Only
528works on Mac OS X.
529.IP PYTHONUSERBASE
530Defines the user base directory, which is used to compute the path of the user
531.IR site-packages
532directory and Distutils installation paths for
533.IR "python setup\.py install \-\-user" .
534.IP PYTHONPROFILEIMPORTTIME
535If this environment variable is set to a non-empty string, Python will
536show how long each import takes. This is exactly equivalent to setting
537\fB\-X importtime\fP on the command line.
Stéphane Wirtelb7fd7382018-07-29 12:27:16 +0200538.IP PYTHONBREAKPOINT
539If this environment variable is set to 0, it disables the default debugger. It
540can be set to the callable of your debugger of choice.
Berker Peksag9863de02018-07-09 22:17:54 +0300541.SS Debug-mode variables
542Setting these variables only has an effect in a debug build of Python, that is,
543if Python was configured with the
544\fB\--with-pydebug\fP build option.
545.IP PYTHONTHREADDEBUG
546If this environment variable is set, Python will print threading debug info.
547.IP PYTHONDUMPREFS
548If this environment variable is set, Python will dump objects and reference
549counts still alive after shutting down the interpreter.
Guido van Rossuma7925f11994-01-26 10:20:16 +0000550.SH AUTHOR
Benjamin Peterson37c4f782015-05-10 21:19:18 -0400551The Python Software Foundation: https://www.python.org/psf/
Guido van Rossum74faed21996-07-30 19:27:05 +0000552.SH INTERNET RESOURCES
Benjamin Peterson755640b2015-04-30 17:37:11 -0400553Main website: https://www.python.org/
Guido van Rossum74faed21996-07-30 19:27:05 +0000554.br
Benjamin Peterson755640b2015-04-30 17:37:11 -0400555Documentation: https://docs.python.org/
Guido van Rossumf4a090d2000-09-01 20:36:34 +0000556.br
Lisa Hewus Fresh384899d2017-08-30 09:37:43 -0700557Developer resources: https://devguide.python.org/
Guido van Rossumf4a090d2000-09-01 20:36:34 +0000558.br
Benjamin Peterson755640b2015-04-30 17:37:11 -0400559Downloads: https://www.python.org/downloads/
Guido van Rossumf4a090d2000-09-01 20:36:34 +0000560.br
Ned Deily9d6d06e2018-06-11 00:45:50 -0400561Module repository: https://pypi.org/
Guido van Rossum74faed21996-07-30 19:27:05 +0000562.br
Fred Drakebd2e3b02001-07-26 21:25:58 +0000563Newsgroups: comp.lang.python, comp.lang.python.announce
Guido van Rossumf4a090d2000-09-01 20:36:34 +0000564.SH LICENSING
565Python is distributed under an Open Source license. See the file
566"LICENSE" in the Python source distribution for information on terms &
567conditions for accessing and otherwise using Python and for a
568DISCLAIMER OF ALL WARRANTIES.