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