You're using Python launcher for Windows when you executepy
. You could be specific about which Python interpreter version that you want py
to execute with this command:
> py -3.6
See this section from PEP 397:
Python Version Qualifiers
If no version qualifiers are found in a command, the environment
variable PY_PYTHON
can be set to specify the default version qualifier
-
the default value is "2". Note this value could specify just a major version (e.g. "2") or a major.minor
qualifier (e.g. "2.6"), or even
major.minor-32
.
If no minor version qualifiers are found, the environment variable
PY_PYTHON{major}
(where {major}
is the current major version qualifier
as determined above) can be set to specify the full version. If no
such option is found, the launcher will enumerate the installed Python
versions and use the latest minor release found for the major version,
which is likely, although not guaranteed, to be the most recently
installed version in that family.
In addition to environment variables, the same settings can be
configured in the .INI file used by the launcher. The section in the
INI file is called [defaults] and the key name will be the same as the
environment variables without the leading PY_ prefix
(and note that
the key names in the INI file are case insensitive.) The contents of
an environment variable will override things specified in the INI
file.
Plus Python launcher isn't just limited to launching different Python versions, it also parses shebang #!
in source code files, providing a functionality similar to that in *nix operating systems in Windows.
*Refer to Python Launcher for Windows documentation.