1PY(1)                           Python Launcher                          PY(1)
2
3
4

NAME

6       py - launch a Python interpreter
7

SYNOPSIS

9       py [-[X]/[X.Y]] ...
10

DESCRIPTION

12       py launches the most appropriate Python interpreter it can find.  It is
13       meant to act as a shorthand for  launching  python  without  having  to
14       think  about  which Python interpreter is the most desired.  The Python
15       Launcher is not meant to  substitute  all  ways  of  launching  Python,
16       e.g. if  a specific Python interpreter is desired then it is assumed it
17       will be directly executed.
18

SPECIFYING A PYTHON VERSION

20       If a command-line option is provided in the form of -X or -X.Y where  X
21       and  Y  are  integers, then that version of Python will be launched (if
22       available).  For instance, providing -3 will launch the newest  version
23       of Python 3 while -3.6 will try to launch Python 3.6.
24

SEARCHING FOR PYTHON INTERPRETERS

26       When  no  command-line  arguments are provided to the launcher, what is
27       deemed the most “appropriate” interpreter is searched for as follows:
28
29       1. An activated virtual environment (launched immediately if available)
30
31       2. A .venv directory in the current working directory or any parent di‐
32          rectory  containing  a  virtual environment (launched immediately if
33          available)
34
35       3. If a file path is provided as the first argument, look for a shebang
36          line containing /usr/bin/python, /usr/local/bin/python, /usr/bin/env
37          python or python and any version  specification  in  the  executable
38          name  is  treated as a version specifier (like with -X/-X.Y command-
39          line options)
40
41       4. Check for any appropriate environment variable (see ENVIRONMENT)
42
43       5. Search PATH for all pythonX.Y executables
44
45       6. Launch the newest version of Python (while matching any version  re‐
46          strictions previously specified)
47
48       All  unrecognized  command-line arguments are passed on to the launched
49       Python interpreter.
50

OPTIONS

52       -h/–help
53              Print a help message and exit; must be specified on its own.
54
55       –list  List all known interpreters (except activated  virtual  environ‐
56              ment); must be specified on its own.
57
58       -[X]   Launch  the  latest  Python  X  version  (e.g. -3 for the latest
59              Python 3).  See ENVIRONMENT for details on the PY_VERSION[X] en‐
60              vironment variable.
61
62       -[X.Y] Launch the specified Python version (e.g. -3.6 for Python 3.6).
63

ENVIRONMENT

65       PY_PYTHON
66              Specify  the version of Python to search for when no Python ver‐
67              sion is  explicitly  requested  (must  be  formatted  as  `X.Y';
68              e.g. 3.6 to use Python 3.6 by default).
69
70       PY_PYTHON[X]
71              Specify  the  version  of Python to search for when only a major
72              version is specified  (must  be  formatted  as  `X.Y';  e.g. set
73              PY_PYTHON3 to 3.6 to cause -3 to use Python 3.6).
74
75       PYLAUNCH_DEBUG
76              Log details to stderr about how the Launcher is operating.
77
78       VIRTUAL_ENV
79              Path to a directory containing virtual enviroment to use when no
80              Python version is explicitly requested; typically set  by  acti‐
81              vating a virtual environment.
82
83       PATH   Used to search for Python interpreters.
84

AUTHORS

86       Copyright © 2018 Brett Cannon.
87
88       Licensed under MIT.
89

HOMEPAGE

91       https://github.com/brettcannon/python-launcher/
92

SEE ALSO

94       python(1), python3(1).
95
96
97
98Python Launcher 0.16.1            2021-06-18                             PY(1)
Impressum