python-launcher: pyenv 'command not found' with system python set
Describe the bug
Encountering error running py
due to pyenv installed and set to system
$ py
pyenv: python3.9: command not found
The `python3.9' command exists in these Python versions:
3.9.2
Note: See 'pyenv help global' for tips on allowing both
python2 and python3 to be found.
To Reproduce
- Install
pyenv
- pyenv install 3.9.2
- cargo install python-launcher
- py
Tried export PY_PYTHON
as per FAQ but version file does not exist if global not set:
head: cannot open '~/.pyenv/version' for reading: No such file or directory
So tried creating file with pyenv global
but that also failed on the special string system
:
Error parsing 'system' as an integer: invalid digit found in string
Expected behaviour Opens system python 3.8 prompt
Screenshots
$ pyenv versions
* system (set by ~/.pyenv/version)
3.9.2
$ py --list
3.9 │ ~/.pyenv/shims/python3.9
3.8 │ /usr/bin/python3.8
3.6 │ /usr/bin/python3.6
2.7 │ /usr/bin/python2.7
System Details (please complete the following information):
- OS: Ubuntu 20.04
- Shell: bash
- Launcher Version: 1.0.0
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (13 by maintainers)
It works for all combinations however for completeness need to include
PY_PYTHON3
forpy -3
command:* Didn’t use print sep arg for python just in-case python2 is being used.
The final issue to note is that once env vars are set any changes to pyenv global will not update them until session reload. Could be fixed with alias for
py
prefixed with env vars set at runtime but might be overkill.That’s still pyenv-specific and so I would rather not do that.
I don’t want to go that far as people like @jefftriplett have shown they get use out of the Launcher with pyenv (as has @treyhunner and other folks who helped write that FAQ entry). Maybe they can share how they make them work together?
Then the Launcher isn’t necessarily that useful. It still helps with shebangs and using the newest version of Python and using virtual environments automatically. But if you’re already using pyenv to accomplish this then you don’t need the Launcher (or you can obviously switch over if you want 😉).
Otherwise we can add a disclaimer to the FAQ entry to say
system
is not a supported version (or both; simple sample or more complex sample depending on what people want).