
April 26, 2022
4:13 p.m.
On 4/26/22, Victor Stinner <vstinner@python.org> wrote:
There are 4 main ways to run Python:
(1) python -m module [...] (2) python script.py [...] (3) python -c code [...] (4) python [...]
(1) and (2) insert the directory of the module/script at sys.path[0].
Running a module with -m inserts the current working directory (the path, not an empty string) at sys.path[0], followed by the module directory at sys.path[1]. Only one entry is added if they're the same directory.