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