On Mon, 1 Mar 2021 at 00:13, Eryk Sun <eryk...@gmail.com> wrote: > > On 2/28/21, Oscar Benjamin <oscar.j.benja...@gmail.com> wrote: > > > > - It is possible to configure a default version (although I think you > > have to do it with an environment variable) > > The py launcher in Windows supports a "py.ini" file beside the > executable and in %LocalAppData%. The equivalent of the PY_PYTHON, > PY_PYTHON2, and PY_PYTHON3 environment variables can be set in the > "[defaults]" section as "python", "python2", and "python3" settings. > > The ini file also supports a "[commands]" section to define additional > virtual commands for shebangs. Regular filepaths are also supported in > shebangs -- e.g. #!"path\to\any\program.exe".
Yes, I forgot about that. I still think it would be better if you could do it with the py command... > > - I think that the launcher is only installed in an all users install. > > It defaults to an all-users install, but it can also be installed for > just the current user in "%LocalAppData%\Programs\Python\Launcher". In > this case, the installation directory always gets added to PATH. Oh, okay. So does that mean that it's always on PATH unless the user *explicitly unticks* the "install the launcher" box for both single user and all user installs? > > - It would be better if you could use the launcher itself to set the > > default Python e.g. "py --set-default-python=3.8" > > It's pretty simply to run `set PY_PYTHON=3.8`, and persist the value > in the registry with `setx.exe PY_PYTHON 3.8`. (But don't use setx.exe > naively to set PATH.) Those commands aren't portable to any other OS though. The advantage of having it done through py is that it can (hopefully) be made consistent across platforms. > > On the last point I think that although Anaconda doesn't install the > > launcher you can use the launcher to run the python from the Anaconda > > installation. > > I don't use Anaconda, but I don't think that's supposed to be the case > according to PEP 514. The launcher only looks for PSF development > distributions in the "PythonCore" registry key. Maybe I misunderstood the situation. If py can only be used for PSF binaries then that wouldn't work. I guess that can be changed though... -- Oscar _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/VDB4RXS3RUO6ALU4S22N6PKWTHIHWI2K/ Code of Conduct: http://python.org/psf/codeofconduct/