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