-
Notifications
You must be signed in to change notification settings - Fork 431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows: Use the Python Launcher to Select Python Version #940
Comments
Instead of magically mapping |
Thanks @uranusjr for the feedback. I was thinking that it might be nice to have common commands across platforms so that pipx would figure out the right interpreter command, but I understand wanting to avoid magical mapping. Do you have a preference between |
Personally I feel |
I started working on this today. I think the order of looking up python should be:
2-4 are already part of the DEFAULT_PYTHON determination. For 1, we can override the interpreter in the It took me a little while to figure out the workflow, all tests were failing with nox on Windows, and I submitted #1000 to fix it. Also being able to use |
In macOS and Linux, pipx allows you to set the Python version using the
--python
option. For example,pipx install --python python3.11 black
. However, in Windows, all Python executables are namedpython.exe
. So the only solution I have found to tell pipx the interpreter is by giving the full path like:The standard way to select a Python version in Windows is with the Python Launcher. For example,
py -3.11
, will launch Python 3.11. It is possible to use the launcher with pipx withpipx install --python py black
. However, I don't see a way to tellpy
which version of Python to use.How would this feature be useful?
In Windows on GitHub Actions, pipx is installed by default with Python 3.9. I would like to run the setup-python action and then tell pipx to use this later Python version.
Describe the solution you'd like
pipx install --python 3.11 black
would usepy -3.11
on Windows andpython3.11
in Linux/macOS. An alternative might be--python py311
which is the format tox uses.Describe alternatives you've considered
Reinstall pipx for each Python version, or use the full path to the Python executable.
I would be glad to help implement this if there is agreement that this would be a nice enhancement.
The text was updated successfully, but these errors were encountered: