Guido van Rossum | 97bac53 | 2001-09-05 18:57:51 +0000 | [diff] [blame] | 1 | .TH PYTHON "1" "$Date$" |
Andrew M. Kuchling | 3afe4f3 | 2004-10-07 12:30:54 +0000 | [diff] [blame] | 2 | |
Matthias Klose | 8ed2520 | 2009-03-22 13:08:22 +0000 | [diff] [blame] | 3 | .\" To view this file while editing, run it through groff: |
| 4 | .\" groff -Tascii -man python.man | less |
Andrew M. Kuchling | 3afe4f3 | 2004-10-07 12:30:54 +0000 | [diff] [blame] | 5 | |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 6 | .SH NAME |
| 7 | python \- an interpreted, interactive, object-oriented programming language |
| 8 | .SH SYNOPSIS |
| 9 | .B python |
| 10 | [ |
Matthias Klose | 626d92a | 2010-01-31 16:05:13 +0000 | [diff] [blame] | 11 | .B \-B |
| 12 | ] |
| 13 | [ |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 14 | .B \-d |
| 15 | ] |
| 16 | [ |
Guido van Rossum | b674baf | 2001-09-05 18:55:34 +0000 | [diff] [blame] | 17 | .B \-E |
| 18 | ] |
| 19 | [ |
| 20 | .B \-h |
| 21 | ] |
| 22 | [ |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 23 | .B \-i |
| 24 | ] |
| 25 | [ |
Andrew M. Kuchling | 166e625 | 2004-10-07 12:04:50 +0000 | [diff] [blame] | 26 | .B \-m |
| 27 | .I module-name |
| 28 | ] |
Guido van Rossum | b674baf | 2001-09-05 18:55:34 +0000 | [diff] [blame] | 29 | .br |
| 30 | [ |
Matthias Klose | 626d92a | 2010-01-31 16:05:13 +0000 | [diff] [blame] | 31 | .B \-O |
| 32 | ] |
| 33 | [ |
R David Murray | f9860c8 | 2011-05-01 11:12:35 -0400 | [diff] [blame] | 34 | .B \-OO |
Matthias Klose | 626d92a | 2010-01-31 16:05:13 +0000 | [diff] [blame] | 35 | ] |
| 36 | [ |
Barry Warsaw | 1e13eb0 | 2012-02-20 20:42:21 -0500 | [diff] [blame] | 37 | .B \-R |
| 38 | ] |
| 39 | [ |
Guido van Rossum | b674baf | 2001-09-05 18:55:34 +0000 | [diff] [blame] | 40 | .B -Q |
| 41 | .I argument |
Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 42 | ] |
| 43 | [ |
Matthias Klose | 626d92a | 2010-01-31 16:05:13 +0000 | [diff] [blame] | 44 | .B \-s |
| 45 | ] |
| 46 | [ |
Guido van Rossum | b674baf | 2001-09-05 18:55:34 +0000 | [diff] [blame] | 47 | .B \-S |
Neil Schemenauer | 7d4bb9f | 2001-07-23 16:30:27 +0000 | [diff] [blame] | 48 | ] |
| 49 | [ |
Guido van Rossum | 29d465b | 1998-04-10 19:36:09 +0000 | [diff] [blame] | 50 | .B \-t |
| 51 | ] |
| 52 | [ |
Guido van Rossum | ef5bca3 | 1994-05-03 14:15:32 +0000 | [diff] [blame] | 53 | .B \-u |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 54 | ] |
Guido van Rossum | b674baf | 2001-09-05 18:55:34 +0000 | [diff] [blame] | 55 | .br |
| 56 | [ |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 57 | .B \-v |
| 58 | ] |
Guido van Rossum | 07c44c7 | 1998-04-10 19:46:00 +0000 | [diff] [blame] | 59 | [ |
Barry Warsaw | 6456937 | 2000-09-15 18:39:09 +0000 | [diff] [blame] | 60 | .B \-V |
| 61 | ] |
Guido van Rossum | 1378c32 | 2000-12-19 03:21:54 +0000 | [diff] [blame] | 62 | [ |
| 63 | .B \-W |
| 64 | .I argument |
| 65 | ] |
Guido van Rossum | b674baf | 2001-09-05 18:55:34 +0000 | [diff] [blame] | 66 | [ |
| 67 | .B \-x |
| 68 | ] |
Benjamin Peterson | c4431ee | 2009-01-09 03:05:14 +0000 | [diff] [blame] | 69 | [ |
| 70 | .B \-3 |
| 71 | ] |
Matthias Klose | 626d92a | 2010-01-31 16:05:13 +0000 | [diff] [blame] | 72 | [ |
| 73 | .B \-? |
| 74 | ] |
Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 75 | .br |
| 76 | [ |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 77 | .B \-c |
| 78 | .I command |
| 79 | | |
| 80 | .I script |
| 81 | | |
| 82 | \- |
| 83 | ] |
| 84 | [ |
| 85 | .I arguments |
| 86 | ] |
| 87 | .SH DESCRIPTION |
| 88 | Python is an interpreted, interactive, object-oriented programming |
| 89 | language that combines remarkable power with very clear syntax. |
| 90 | For an introduction to programming in Python you are referred to the |
| 91 | Python Tutorial. |
| 92 | The Python Library Reference documents built-in and standard types, |
| 93 | constants, functions and modules. |
| 94 | Finally, the Python Reference Manual describes the syntax and |
| 95 | semantics of the core language in (perhaps too) much detail. |
Guido van Rossum | f4a090d | 2000-09-01 20:36:34 +0000 | [diff] [blame] | 96 | (These documents may be located via the |
| 97 | .B "INTERNET RESOURCES" |
Fred Drake | 4c9be9d | 1999-08-20 13:10:20 +0000 | [diff] [blame] | 98 | below; they may be installed on your system as well.) |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 99 | .PP |
| 100 | Python's basic power can be extended with your own modules written in |
| 101 | C or C++. |
Guido van Rossum | 74faed2 | 1996-07-30 19:27:05 +0000 | [diff] [blame] | 102 | On most systems such modules may be dynamically loaded. |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 103 | Python is also adaptable as an extension language for existing |
| 104 | applications. |
| 105 | See the internal documentation for hints. |
Andrew M. Kuchling | 88717f4 | 2001-04-05 14:50:40 +0000 | [diff] [blame] | 106 | .PP |
| 107 | Documentation for installed Python modules and packages can be |
| 108 | viewed by running the |
| 109 | .B pydoc |
| 110 | program. |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 111 | .SH COMMAND LINE OPTIONS |
| 112 | .TP |
Matthias Klose | 626d92a | 2010-01-31 16:05:13 +0000 | [diff] [blame] | 113 | .B \-B |
| 114 | Don't write |
| 115 | .I .py[co] |
| 116 | files on import. See also PYTHONDONTWRITEBYTECODE. |
| 117 | .TP |
Guido van Rossum | b674baf | 2001-09-05 18:55:34 +0000 | [diff] [blame] | 118 | .BI "\-c " command |
| 119 | Specify the command to execute (see next section). |
| 120 | This terminates the option list (following options are passed as |
| 121 | arguments to the command). |
| 122 | .TP |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 123 | .B \-d |
| 124 | Turn on parser debugging output (for wizards only, depending on |
| 125 | compilation options). |
Guido van Rossum | 9f65ae0 | 1994-02-23 09:10:27 +0000 | [diff] [blame] | 126 | .TP |
Guido van Rossum | b674baf | 2001-09-05 18:55:34 +0000 | [diff] [blame] | 127 | .B \-E |
| 128 | Ignore environment variables like PYTHONPATH and PYTHONHOME that modify |
| 129 | the behavior of the interpreter. |
| 130 | .TP |
Matthias Klose | 626d92a | 2010-01-31 16:05:13 +0000 | [diff] [blame] | 131 | .B \-h ", " \-? ", "\-\-help |
Guido van Rossum | b674baf | 2001-09-05 18:55:34 +0000 | [diff] [blame] | 132 | Prints the usage for the interpreter executable and exits. |
| 133 | .TP |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 134 | .B \-i |
| 135 | When a script is passed as first argument or the \fB\-c\fP option is |
| 136 | used, enter interactive mode after executing the script or the |
Guido van Rossum | 9f65ae0 | 1994-02-23 09:10:27 +0000 | [diff] [blame] | 137 | command. It does not read the $PYTHONSTARTUP file. This can be |
| 138 | useful to inspect global variables or a stack trace when a script |
| 139 | raises an exception. |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 140 | .TP |
Andrew M. Kuchling | 166e625 | 2004-10-07 12:04:50 +0000 | [diff] [blame] | 141 | .BI "\-m " module-name |
| 142 | Searches |
| 143 | .I sys.path |
| 144 | for the named module and runs the corresponding |
| 145 | .I .py |
| 146 | file as a script. |
| 147 | .TP |
Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 148 | .B \-O |
| 149 | Turn on basic optimizations. This changes the filename extension for |
| 150 | compiled (bytecode) files from |
| 151 | .I .pyc |
Fred Drake | 4c9be9d | 1999-08-20 13:10:20 +0000 | [diff] [blame] | 152 | to \fI.pyo\fP. Given twice, causes docstrings to be discarded. |
Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 153 | .TP |
R David Murray | f9860c8 | 2011-05-01 11:12:35 -0400 | [diff] [blame] | 154 | .B \-OO |
Matthias Klose | 626d92a | 2010-01-31 16:05:13 +0000 | [diff] [blame] | 155 | Discard docstrings in addition to the \fB-O\fP optimizations. |
| 156 | .TP |
Barry Warsaw | 1e13eb0 | 2012-02-20 20:42:21 -0500 | [diff] [blame] | 157 | .B \-R |
| 158 | Turn on "hash randomization", so that the hash() values of str, bytes and |
| 159 | datetime objects are "salted" with an unpredictable pseudo-random value. |
| 160 | Although they remain constant within an individual Python process, they are |
| 161 | not predictable between repeated invocations of Python. |
| 162 | .IP |
| 163 | This is intended to provide protection against a denial of service |
| 164 | caused by carefully-chosen inputs that exploit the worst case performance |
Georg Brandl | 3aec568 | 2012-02-21 22:36:27 +0100 | [diff] [blame] | 165 | of a dict construction, O(n^2) complexity. See |
Barry Warsaw | 1e13eb0 | 2012-02-20 20:42:21 -0500 | [diff] [blame] | 166 | http://www.ocert.org/advisories/ocert-2011-003.html |
| 167 | for details. |
| 168 | .TP |
Guido van Rossum | b674baf | 2001-09-05 18:55:34 +0000 | [diff] [blame] | 169 | .BI "\-Q " argument |
| 170 | Division control; see PEP 238. The argument must be one of "old" (the |
| 171 | default, int/int and long/long return an int or long), "new" (new |
| 172 | division semantics, i.e. int/int and long/long returns a float), |
| 173 | "warn" (old division semantics with a warning for int/int and |
| 174 | long/long), or "warnall" (old division semantics with a warning for |
| 175 | all use of the division operator). For a use of "warnall", see the |
| 176 | Tools/scripts/fixdiv.py script. |
| 177 | .TP |
Matthias Klose | 626d92a | 2010-01-31 16:05:13 +0000 | [diff] [blame] | 178 | .B \-s |
| 179 | Don't add user site directory to sys.path. |
| 180 | .TP |
Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 181 | .B \-S |
| 182 | Disable the import of the module |
| 183 | .I site |
| 184 | and the site-dependent manipulations of |
| 185 | .I sys.path |
| 186 | that it entails. |
| 187 | .TP |
Guido van Rossum | 29d465b | 1998-04-10 19:36:09 +0000 | [diff] [blame] | 188 | .B \-t |
| 189 | Issue a warning when a source file mixes tabs and spaces for |
| 190 | indentation in a way that makes it depend on the worth of a tab |
| 191 | expressed in spaces. Issue an error when the option is given twice. |
| 192 | .TP |
Guido van Rossum | ef5bca3 | 1994-05-03 14:15:32 +0000 | [diff] [blame] | 193 | .B \-u |
Sjoerd Mullender | b6434f2 | 2002-08-09 13:37:31 +0000 | [diff] [blame] | 194 | Force stdin, stdout and stderr to be totally unbuffered. On systems |
| 195 | where it matters, also put stdin, stdout and stderr in binary mode. |
| 196 | Note that there is internal buffering in xreadlines(), readlines() and |
| 197 | file-object iterators ("for line in sys.stdin") which is not |
| 198 | influenced by this option. To work around this, you will want to use |
| 199 | "sys.stdin.readline()" inside a "while 1:" loop. |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 200 | .TP |
| 201 | .B \-v |
| 202 | Print a message each time a module is initialized, showing the place |
Fred Drake | 4c9be9d | 1999-08-20 13:10:20 +0000 | [diff] [blame] | 203 | (filename or built-in module) from which it is loaded. When given |
| 204 | twice, print a message for each file that is checked for when |
| 205 | searching for a module. Also provides information on module cleanup |
| 206 | at exit. |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 207 | .TP |
Matthias Klose | 626d92a | 2010-01-31 16:05:13 +0000 | [diff] [blame] | 208 | .B \-V ", " \-\-version |
Barry Warsaw | 6456937 | 2000-09-15 18:39:09 +0000 | [diff] [blame] | 209 | Prints the Python version number of the executable and exits. |
| 210 | .TP |
Guido van Rossum | 1378c32 | 2000-12-19 03:21:54 +0000 | [diff] [blame] | 211 | .BI "\-W " argument |
| 212 | Warning control. Python sometimes prints warning message to |
| 213 | .IR sys.stderr . |
| 214 | A typical warning message has the following form: |
| 215 | .IB file ":" line ": " category ": " message. |
| 216 | By default, each warning is printed once for each source line where it |
| 217 | occurs. This option controls how often warnings are printed. |
| 218 | Multiple |
| 219 | .B \-W |
| 220 | options may be given; when a warning matches more than one |
| 221 | option, the action for the last matching option is performed. |
| 222 | Invalid |
| 223 | .B \-W |
| 224 | options are ignored (a warning message is printed about invalid |
| 225 | options when the first warning is issued). Warnings can also be |
| 226 | controlled from within a Python program using the |
| 227 | .I warnings |
| 228 | module. |
| 229 | |
| 230 | The simplest form of |
| 231 | .I argument |
| 232 | is one of the following |
| 233 | .I action |
| 234 | strings (or a unique abbreviation): |
| 235 | .B ignore |
| 236 | to ignore all warnings; |
| 237 | .B default |
| 238 | to explicitly request the default behavior (printing each warning once |
| 239 | per source line); |
| 240 | .B all |
| 241 | to print a warning each time it occurs (this may generate many |
| 242 | messages if a warning is triggered repeatedly for the same source |
Fred Drake | bd2e3b0 | 2001-07-26 21:25:58 +0000 | [diff] [blame] | 243 | line, such as inside a loop); |
Guido van Rossum | 1378c32 | 2000-12-19 03:21:54 +0000 | [diff] [blame] | 244 | .B module |
Georg Brandl | 5a85d5c | 2009-06-24 06:41:19 +0000 | [diff] [blame] | 245 | to print each warning only the first time it occurs in each |
Guido van Rossum | 1378c32 | 2000-12-19 03:21:54 +0000 | [diff] [blame] | 246 | module; |
| 247 | .B once |
| 248 | to print each warning only the first time it occurs in the program; or |
| 249 | .B error |
| 250 | to raise an exception instead of printing a warning message. |
| 251 | |
| 252 | The full form of |
| 253 | .I argument |
| 254 | is |
| 255 | .IB action : message : category : module : line. |
| 256 | Here, |
| 257 | .I action |
| 258 | is as explained above but only applies to messages that match the |
| 259 | remaining fields. Empty fields match all values; trailing empty |
| 260 | fields may be omitted. The |
| 261 | .I message |
| 262 | field matches the start of the warning message printed; this match is |
| 263 | case-insensitive. The |
| 264 | .I category |
| 265 | field matches the warning category. This must be a class name; the |
| 266 | match test whether the actual warning category of the message is a |
| 267 | subclass of the specified warning category. The full class name must |
| 268 | be given. The |
| 269 | .I module |
| 270 | field matches the (fully-qualified) module name; this match is |
| 271 | case-sensitive. The |
| 272 | .I line |
| 273 | field matches the line number, where zero matches all line numbers and |
| 274 | is thus equivalent to an omitted line number. |
| 275 | .TP |
Guido van Rossum | b674baf | 2001-09-05 18:55:34 +0000 | [diff] [blame] | 276 | .B \-x |
| 277 | Skip the first line of the source. This is intended for a DOS |
| 278 | specific hack only. Warning: the line numbers in error messages will |
| 279 | be off by one! |
Benjamin Peterson | c4431ee | 2009-01-09 03:05:14 +0000 | [diff] [blame] | 280 | .TP |
| 281 | .B \-3 |
| 282 | Warn about Python 3.x incompatibilities that 2to3 cannot trivially fix. |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 283 | .SH INTERPRETER INTERFACE |
| 284 | The interpreter interface resembles that of the UNIX shell: when |
| 285 | called with standard input connected to a tty device, it prompts for |
| 286 | commands and executes them until an EOF is read; when called with a |
| 287 | file name argument or with a file as standard input, it reads and |
| 288 | executes a |
| 289 | .I script |
| 290 | from that file; |
| 291 | when called with |
| 292 | .B \-c |
| 293 | .I command, |
| 294 | it executes the Python statement(s) given as |
| 295 | .I command. |
| 296 | Here |
| 297 | .I command |
| 298 | may contain multiple statements separated by newlines. |
| 299 | Leading whitespace is significant in Python statements! |
Matthias Klose | 31a58df | 2005-03-20 14:16:03 +0000 | [diff] [blame] | 300 | In non-interactive mode, the entire input is parsed before it is |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 301 | executed. |
| 302 | .PP |
| 303 | If available, the script name and additional arguments thereafter are |
| 304 | passed to the script in the Python variable |
| 305 | .I sys.argv , |
| 306 | which is a list of strings (you must first |
| 307 | .I import sys |
| 308 | to be able to access it). |
| 309 | If no script name is given, |
Guido van Rossum | f4a090d | 2000-09-01 20:36:34 +0000 | [diff] [blame] | 310 | .I sys.argv[0] |
| 311 | is an empty string; if |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 312 | .B \-c |
| 313 | is used, |
| 314 | .I sys.argv[0] |
| 315 | contains the string |
| 316 | .I '-c'. |
Guido van Rossum | 74faed2 | 1996-07-30 19:27:05 +0000 | [diff] [blame] | 317 | Note that options interpreted by the Python interpreter itself |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 318 | are not placed in |
| 319 | .I sys.argv. |
| 320 | .PP |
| 321 | In interactive mode, the primary prompt is `>>>'; the second prompt |
| 322 | (which appears when a command is not complete) is `...'. |
| 323 | The prompts can be changed by assignment to |
| 324 | .I sys.ps1 |
| 325 | or |
| 326 | .I sys.ps2. |
| 327 | The interpreter quits when it reads an EOF at a prompt. |
| 328 | When an unhandled exception occurs, a stack trace is printed and |
| 329 | control returns to the primary prompt; in non-interactive mode, the |
| 330 | interpreter exits after printing the stack trace. |
| 331 | The interrupt signal raises the |
| 332 | .I Keyboard\%Interrupt |
| 333 | exception; other UNIX signals are not caught (except that SIGPIPE is |
| 334 | sometimes ignored, in favor of the |
| 335 | .I IOError |
| 336 | exception). Error messages are written to stderr. |
| 337 | .SH FILES AND DIRECTORIES |
| 338 | These are subject to difference depending on local installation |
Fred Drake | 4c9be9d | 1999-08-20 13:10:20 +0000 | [diff] [blame] | 339 | conventions; ${prefix} and ${exec_prefix} are installation-dependent |
| 340 | and should be interpreted as for GNU software; they may be the same. |
| 341 | The default for both is \fI/usr/local\fP. |
| 342 | .IP \fI${exec_prefix}/bin/python\fP |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 343 | Recommended location of the interpreter. |
Fred Drake | 4c9be9d | 1999-08-20 13:10:20 +0000 | [diff] [blame] | 344 | .PP |
| 345 | .I ${prefix}/lib/python<version> |
| 346 | .br |
| 347 | .I ${exec_prefix}/lib/python<version> |
| 348 | .RS |
| 349 | Recommended locations of the directories containing the standard |
| 350 | modules. |
| 351 | .RE |
| 352 | .PP |
| 353 | .I ${prefix}/include/python<version> |
| 354 | .br |
| 355 | .I ${exec_prefix}/include/python<version> |
| 356 | .RS |
| 357 | Recommended locations of the directories containing the include files |
| 358 | needed for developing Python extensions and embedding the |
| 359 | interpreter. |
| 360 | .RE |
| 361 | .IP \fI~/.pythonrc.py\fP |
| 362 | User-specific initialization file loaded by the \fIuser\fP module; |
| 363 | not used by default or by most applications. |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 364 | .SH ENVIRONMENT VARIABLES |
Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 365 | .IP PYTHONHOME |
| 366 | Change the location of the standard Python libraries. By default, the |
Fred Drake | 4c9be9d | 1999-08-20 13:10:20 +0000 | [diff] [blame] | 367 | libraries are searched in ${prefix}/lib/python<version> and |
| 368 | ${exec_prefix}/lib/python<version>, where ${prefix} and ${exec_prefix} |
Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 369 | are installation-dependent directories, both defaulting to |
Fred Drake | 4c9be9d | 1999-08-20 13:10:20 +0000 | [diff] [blame] | 370 | \fI/usr/local\fP. When $PYTHONHOME is set to a single directory, its value |
| 371 | replaces both ${prefix} and ${exec_prefix}. To specify different values |
| 372 | for these, set $PYTHONHOME to ${prefix}:${exec_prefix}. |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 373 | .IP PYTHONPATH |
| 374 | Augments the default search path for module files. |
| 375 | The format is the same as the shell's $PATH: one or more directory |
| 376 | pathnames separated by colons. |
Matthias Klose | 31a58df | 2005-03-20 14:16:03 +0000 | [diff] [blame] | 377 | Non-existent directories are silently ignored. |
Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 378 | The default search path is installation dependent, but generally |
Fred Drake | 4c9be9d | 1999-08-20 13:10:20 +0000 | [diff] [blame] | 379 | begins with ${prefix}/lib/python<version> (see PYTHONHOME above). |
Guido van Rossum | 4cf4de5 | 1997-09-08 04:06:15 +0000 | [diff] [blame] | 380 | The default search path is always appended to $PYTHONPATH. |
Guido van Rossum | 74faed2 | 1996-07-30 19:27:05 +0000 | [diff] [blame] | 381 | If a script argument is given, the directory containing the script is |
| 382 | inserted in the path in front of $PYTHONPATH. |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 383 | The search path can be manipulated from within a Python program as the |
| 384 | variable |
| 385 | .I sys.path . |
| 386 | .IP PYTHONSTARTUP |
| 387 | If this is the name of a readable file, the Python commands in that |
| 388 | file are executed before the first prompt is displayed in interactive |
| 389 | mode. |
| 390 | The file is executed in the same name space where interactive commands |
| 391 | are executed so that objects defined or imported in it can be used |
| 392 | without qualification in the interactive session. |
| 393 | You can also change the prompts |
| 394 | .I sys.ps1 |
| 395 | and |
| 396 | .I sys.ps2 |
| 397 | in this file. |
Fred Drake | bd2e3b0 | 2001-07-26 21:25:58 +0000 | [diff] [blame] | 398 | .IP PYTHONY2K |
| 399 | Set this to a non-empty string to cause the \fItime\fP module to |
| 400 | require dates specified as strings to include 4-digit years, otherwise |
| 401 | 2-digit years are converted based on rules described in the \fItime\fP |
Andrew M. Kuchling | b2cb37f | 2002-05-09 14:33:18 +0000 | [diff] [blame] | 402 | module documentation. |
Guido van Rossum | 9abaf4d | 2001-10-12 22:17:56 +0000 | [diff] [blame] | 403 | .IP PYTHONOPTIMIZE |
| 404 | If this is set to a non-empty string it is equivalent to specifying |
| 405 | the \fB\-O\fP option. If set to an integer, it is equivalent to |
| 406 | specifying \fB\-O\fP multiple times. |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 407 | .IP PYTHONDEBUG |
| 408 | If this is set to a non-empty string it is equivalent to specifying |
Guido van Rossum | 9abaf4d | 2001-10-12 22:17:56 +0000 | [diff] [blame] | 409 | the \fB\-d\fP option. If set to an integer, it is equivalent to |
| 410 | specifying \fB\-d\fP multiple times. |
Matthias Klose | 626d92a | 2010-01-31 16:05:13 +0000 | [diff] [blame] | 411 | .IP PYTHONDONTWRITEBYTECODE |
| 412 | If this is set to a non-empty string it is equivalent to specifying |
| 413 | the \fB\-B\fP option (don't try to write |
| 414 | .I .py[co] |
| 415 | files). |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 416 | .IP PYTHONINSPECT |
| 417 | If this is set to a non-empty string it is equivalent to specifying |
| 418 | the \fB\-i\fP option. |
Benjamin Peterson | a5cb39f | 2010-10-13 22:25:26 +0000 | [diff] [blame] | 419 | .IP PYTHONIOENCODING |
| 420 | If this is set before running the interpreter, it overrides the encoding used |
| 421 | for stdin/stdout/stderr, in the syntax |
| 422 | .IB encodingname ":" errorhandler |
| 423 | The |
| 424 | .IB errorhandler |
| 425 | part is optional and has the same meaning as in str.encode. For stderr, the |
| 426 | .IB errorhandler |
| 427 | part is ignored; the handler will always be \'backslashreplace\'. |
Matthias Klose | 626d92a | 2010-01-31 16:05:13 +0000 | [diff] [blame] | 428 | .IP PYTHONNOUSERSITE |
Benjamin Peterson | a5cb39f | 2010-10-13 22:25:26 +0000 | [diff] [blame] | 429 | If this is set to a non-empty string it is equivalent to specifying the |
| 430 | \fB\-s\fP option (Don't add the user site directory to sys.path). |
Guido van Rossum | ef5bca3 | 1994-05-03 14:15:32 +0000 | [diff] [blame] | 431 | .IP PYTHONUNBUFFERED |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 432 | If this is set to a non-empty string it is equivalent to specifying |
Guido van Rossum | ef5bca3 | 1994-05-03 14:15:32 +0000 | [diff] [blame] | 433 | the \fB\-u\fP option. |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 434 | .IP PYTHONVERBOSE |
| 435 | If this is set to a non-empty string it is equivalent to specifying |
Guido van Rossum | 9abaf4d | 2001-10-12 22:17:56 +0000 | [diff] [blame] | 436 | the \fB\-v\fP option. If set to an integer, it is equivalent to |
| 437 | specifying \fB\-v\fP multiple times. |
Philip Jenvey | 5a5a37c | 2010-04-06 23:38:57 +0000 | [diff] [blame] | 438 | .IP PYTHONWARNINGS |
| 439 | If this is set to a comma-separated string it is equivalent to |
| 440 | specifying the \fB\-W\fP option for each separate value. |
Barry Warsaw | 1e13eb0 | 2012-02-20 20:42:21 -0500 | [diff] [blame] | 441 | .IP PYTHONHASHSEED |
| 442 | If this variable is set to "random", the effect is the same as specifying |
| 443 | the \fB-R\fP option: a random value is used to seed the hashes of str, |
| 444 | bytes and datetime objects. |
| 445 | |
| 446 | If PYTHONHASHSEED is set to an integer value, it is used as a fixed seed for |
| 447 | generating the hash() of the types covered by the hash randomization. Its |
| 448 | purpose is to allow repeatable hashing, such as for selftests for the |
| 449 | interpreter itself, or to allow a cluster of python processes to share hash |
| 450 | values. |
| 451 | |
| 452 | The integer must be a decimal number in the range [0,4294967295]. Specifying |
| 453 | the value 0 will lead to the same hash values as when hash randomization is |
| 454 | disabled. |
Guido van Rossum | a7925f1 | 1994-01-26 10:20:16 +0000 | [diff] [blame] | 455 | .SH AUTHOR |
Andrew M. Kuchling | 6f59325 | 2004-10-07 12:27:31 +0000 | [diff] [blame] | 456 | The Python Software Foundation: http://www.python.org/psf |
Guido van Rossum | 74faed2 | 1996-07-30 19:27:05 +0000 | [diff] [blame] | 457 | .SH INTERNET RESOURCES |
Fred Drake | bd2e3b0 | 2001-07-26 21:25:58 +0000 | [diff] [blame] | 458 | Main website: http://www.python.org/ |
Guido van Rossum | 74faed2 | 1996-07-30 19:27:05 +0000 | [diff] [blame] | 459 | .br |
Andrew M. Kuchling | 895f245 | 2004-10-07 12:23:12 +0000 | [diff] [blame] | 460 | Documentation: http://docs.python.org/ |
Guido van Rossum | f4a090d | 2000-09-01 20:36:34 +0000 | [diff] [blame] | 461 | .br |
Andrew M. Kuchling | 895f245 | 2004-10-07 12:23:12 +0000 | [diff] [blame] | 462 | Developer resources: http://www.python.org/dev/ |
Guido van Rossum | f4a090d | 2000-09-01 20:36:34 +0000 | [diff] [blame] | 463 | .br |
Benjamin Peterson | 3d85454 | 2009-09-13 01:59:31 +0000 | [diff] [blame] | 464 | Downloads: http://python.org/download/ |
Guido van Rossum | f4a090d | 2000-09-01 20:36:34 +0000 | [diff] [blame] | 465 | .br |
Benjamin Peterson | 3d85454 | 2009-09-13 01:59:31 +0000 | [diff] [blame] | 466 | Module repository: http://pypi.python.org/ |
Guido van Rossum | 74faed2 | 1996-07-30 19:27:05 +0000 | [diff] [blame] | 467 | .br |
Fred Drake | bd2e3b0 | 2001-07-26 21:25:58 +0000 | [diff] [blame] | 468 | Newsgroups: comp.lang.python, comp.lang.python.announce |
Guido van Rossum | f4a090d | 2000-09-01 20:36:34 +0000 | [diff] [blame] | 469 | .SH LICENSING |
| 470 | Python is distributed under an Open Source license. See the file |
| 471 | "LICENSE" in the Python source distribution for information on terms & |
| 472 | conditions for accessing and otherwise using Python and for a |
| 473 | DISCLAIMER OF ALL WARRANTIES. |