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