Tin mới
2. Using Python on Unix platforms
Python documentation for the current stable release
The CPython interpreter scans the command line and the environment for various settings.
CPython implementation detail: Other implementations’ command line schemes may differ. See Alternate Implementations for further resources.
The interpreter interface resembles that of the UNIX shell, but provides some additional methods of invocation:
__main__: The environment where the top-level script is run.
Search sys.path for the named module and execute its contents as the __main__ module.
timeit: Measure the execution time of small code snippets.
Search sys.path for the named module and execute its contents as the __main__ module.
Equivalent functionality directly available to Python code
The interpreter interface resembles that of the UNIX shell, but provides some additional methods of invocation:
The semantics of timestamp-based .pyc files are unaffected by this option.
warnings: Issue warning messages and control their disposition.
Warning control. Python’s warning machinery by default prints warning messages to sys.stderr. A typical warning message has the following form:
faulthandler: Dump the Python traceback.
tracemalloc: Trace memory allocations.
-X tracemalloc to start tracing Python memory allocations using the tracemalloc module. By default, only the most recent frame is stored in a traceback of a trace. Use -X tracemalloc=NFRAME to start tracing with a traceb
integer string conversion length limitation
-X int_max_str_digits configures the integer string conversion length limitation. See also PYTHONINTMAXSTRDIGITS.
-X dev: enable Python Development Mode, introducing additional runtime checks that are too expensive to be enabled by default.
Defines the user base directory, which is used to compute the path of the user site-packages directory and Distutils installation paths for python setup.py install --user.
If this environment variable is set to a non-empty string, enable the debug mode of the asyncio module.
If set to the value 0, causes the main Python command line application to skip coercing the legacy ASCII-based C and POSIX locales to a more capable UTF-8 based alternative.