"... command exists in these Python versions" even if there is only one version. #34
Comments
You didn't miss anything. This is by the design of pyenv/rbenv. The active version(s) should be set explicitly. I'm afraid that kind of implicit behaviour might introduce the confusions of Python versions on runtime. I don't like to change current behaviour. |
Though, there is still a chance to change this pyenv's default behaviour in its plugin. Since there is https://github.com/yyuu/pyenv/blob/1a6eb80bcdc3a9746291291d7fe82f4eda36abe3/libexec/pyenv-which#L73 |
Sorry, I don't get it. What should I do exactly? |
Write pyenv plugin to hook I had have written somewhat similar plugin for rbenv, rbenv-which-ext. This is a plugin for rbenv, but it is very close to pyenv. Setting up following bash script as if [ -n "$PYENV_COMMAND" ] && [ ! -x "$PYENV_COMMAND_PATH" ]; then
versions=($(pyenv-whence "${PYENV_COMMAND}" 2>/dev/null || true))
if [ "${#versions[@]}" -eq 1 ]; then
PYENV_COMMAND_PATH="${PYENV_ROOT}/versions/${versions[0]}/bin/${PYENV_COMMAND}"
fi
fi |
I have never read that wiki page. |
Close this tasks since there're no tasks remaining. If you decided to open source your plugin, please add it in Plugins at Wiki. |
Just what I needed, thanks. Made an open-sourced plugin out of this: https://github.com/concordusapps/pyenv-implict |
@mehcode |
@yyuu All in my quest to get meld running in arch (rewrites the meld bin to use python2 instead of python) from within a virtualenv created by pyenv. Had to make this https://gist.github.com/mehcode/6172694 ... share the pain. |
I personally prefer being a bit more explicit. I have a directory ln -s $(pyenv which python2.6) ~/.pyenv-bin-overrides |
@jmagnusson I have noticed that |
@blueyed Unfortunately I don't remember because I no longer use pyenv. Sorry. |
For reference: this approach/plugin causes problems with tox (#214, concordusapps/pyenv-implict#2). |
pyenv local 2.7 3.4.7 it's work for me. |
That's fine, but at least provide a more friendly error message? Now people are required to look the problem up themselves... A simple pyenv global 3.6.5 was what I was looking for. |
I develop my own command line tools in python in their own virtualenvs, so I want to be able to launch a shim in it's own environment if it exists in only one environment, so this is perfect for me. Here's a modified version of the script that can handle de-duping virtualenvs (e.g. a virtualenv called "MINE" shows up as both "MINE" and "X.Y.Z/envs/MINE")
|
This is the simplest solution I've found to use 3.5-3.7 for testing with tox while using 3.6 as the default python:
After this:
Hope this helps somebody! |
We're hitting this issue pyenv/pyenv#34. While it's discoverable, pyenv complains that we must be more explicit. Note in the centos6 image, we'll need `pyenv global 2.7.13 3.6.8` so that both interpreters are available. We only do py3 for this one.
Running pyenv shell 3.X.X before calling |
Unfortunately I have encountered another problem.
I have installed python 2.7.5 with
pyenv install 2.7.5
and thenpyenv rehash
Now if I type
python2.7
I getI think this message should appear if there are others pythonx.y or pythonx version and the command is ambiguous but I have only one python version.
If I set
pyenv local 2.7.5
thenpython2
orpython2.7
will start python correctly.Am I missing something? Is possible to set the default pythonx version?
The text was updated successfully, but these errors were encountered: