python [-B] [-d] [-E] [-h] [-i] [-m module-name]
[-O] [-OO] [-R] [-Q argument] [-s] [-S]
[-t] [-u]
[-v] [-V] [-W argument] [-x] [-3] [-? ]
[-c command | script |-] [ arguments]
Command line options
-v |
quit() or EOF . -c command, executes statement(s) . separated by newlines. import sys, the script name and arguments are passed to the script in
sys.argv, a list of strings . -c is used, sys.argv[sys.argv.
In interactive mode, the primary prompt is >>>; the second prompt (i.e continuation ) is ....
which can be changed by assignment to sys.ps1 or sys.ps2.
When an unhandled exception occurs, a stack trace is output. In non-interactive mode the interpreter exits
Interactively control returns to the primary prompt.
The interrupt signal raises the
KeyboardInterrupt exception; other signals are not caught (SIGPIPE is sometimes ignored, in favor of
the IOError exception).
Error messages are written to stderr.
${prefix} and ${exec_prefix} are installation-dependent. The default for both is
/usr/local. On mac os they are /usr/local/bin
Recommended location of the interpreter.: ${exec_prefix}/bin/python
Recommended locations of the directories containing the standard modules:
${prefix}/lib/pythonversion
${exec_prefix}/lib/pythonversion
Recommended locations of the directories containing the include files needed for developing Python extensions
and embedding the interpreter.:
${prefix}/include/pythonversion
${exec_prefix}/include/pythonversion
User-specific initialization file loaded by the user module; not used by default or by most applications.
~/.pythonrc.py
$PYTHONHOME${prefix}/lib/pythonversion and ${exec_prefix}/lib/pythonversion,
where ${prefix} and ${exec_prefix} are installation-dependent directories, both defaulting to /usr/local.$PYTHONHOME is a single directory, its value replaces both ${prefix} and ${exec_prefix}. To specify different values for these, set $PYTHONHOME to ${prefix}:${exec_prefix}.
$PYTHONPATH
Prepended to the default search path for module files. The format is one or more
directory pathnames separated by colons. Non-existent directories are silently ignored.
The default search path is installation dependent, the recommendataion begins with ${prefix}/lib/pythonversion (see PYTHONHOME ).
With an script argument the directory
containing the script is inserted in the path in before $PYTHONPATH. The search path can be manipulated
in a program as the variable sys.path.
$PYTHONSTARTUP
Executed before the first prompt is displayed in interactive mode.
The file is executed in the same name space where interactive commands are
executed so that objects defined or imported in it can be used without qualification in the interactive session.
You can also change the prompts sys.ps1 and sys.ps2 in this file.
$PYTHONY2K
Set to a non-empty string to causes the time module to require dates specified as strings to include 4-digit
years, otherwise 2-digit years are converted based on rules described in the time module documentation.
$PYTHONOPTIMIZE
A non-empty string equivalent to specifying -O . If an integer, it is equivalent to specifying -O multiple times.
$PYTHONDEBUG
a non-empty string is equivalent to -d . If an integer, equivalent to specifying -d multiple times.
$PYTHONDONTWRITEBYTECODE
a non-empty string is equivalent to specifying -B (don't write .py[co] files).
$PYTHONINSPECT
a non-empty string is equivalent to specifying -i .
$PYTHONIOENCODING
overrides the encoding used for stdin/stdout/stderr, in the
syntax encodingname:[errorhandler] errorhandler has the same meaning as in str.encode.
For stderr, the errorhandler is ignored; the handler will always be 'backslashreplace'.
$PYTHONNOUSERSITE
a non-empty string is equivalent to -s (Don't add the user site directory to sys.path).
$PYTHONUNBUFFERED a non-empty string it is equivalent to specifying -u (unbuffered) .
$PYTHONVERBOSE
If this is set to a non-empty string it is equivalent to specifying the -v option. If set to an integer, it is
equivalent to specifying -v multiple times.
$PYTHONWARNINGS
A comma-separated string is equivalent to -W
$PYTHONHASHSEED
random is the same as -R : a random value is used
to seed the hashes of str, bytes and datetime objects.
$PYTHONHASHSEED is used as a fixed integer seed (0,4294967295) for generating the hash()
of the types covered by hash randomization. This allows repeatable hashing, such as for selftests for the
interpreter itself, or to allow a cluster of python processes to share hash values.
parse_and_bind() use EditLine commands. the preference file is ~/.editrc.
The rlcompleter module, which defines a completion function for the readline modules, works with
the EditLine libraries, needs to be initialized using:
import rlcompleter
import readline
readline.parse_and_bind("bind ^I rl_complete")
For vi mode: readline.parse_and_bind("bind -v")