Tin mới
2. Using Python on Unix platforms
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:
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.
faulthandler: Dump the Python traceback.
-X faulthandler to enable faulthandler. See also PYTHONFAULTHANDLER.
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. See also PYTHONDEVMODE.
Defines the user base directory, which is used to compute the path of the user site-packages directory and installation paths for python -m pip install --user.
If this environment variable is set to a non-empty string, enable the debug mode of the asyncio module.
filesystem encoding and error handler
If set to a non-empty string, the default filesystem encoding and error handler mode will revert to their pre-3.6 values of ‘mbcs’ and ‘replace’, respectively. Otherwise, the new defaults ‘utf-8’ and ‘surrogatepass’ are
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.
If this environment variable is set to a non-empty string, issue a EncodingWarning when the locale-specific default encoding is used.
If set, Python will print threading debug info into stdout.