0

I have the error in the script output

Notice: /Stage[main]/Python/Exec[set-python-global]/returns: pyenv: version `2.7.9' not installed
Error: /usr/local/pyenv/bin/pyenv global 2.7.9 returned 1 instead of one of [0]

However, the command

pyenv versions 

returns correctly:

pyenv versions 
•   system (set by /usr/local/pyenv/version)
2.7.9

Some other commands:

sudo /usr/local/pyenv/bin/pyenv global 2.7.9
pyenv: version `2.7.9' not installed

In the directory

/usr/local/pyenv/versions 

I see the directory 2.7.9

The command

sudo /usr/local/pyenv/bin/pyenv local 2.7.9

Also returns

pyenv: version `2.7.9' not installed

I am on RHEL 7

Alex
  • 7,007
  • 18
  • 69
  • 114

1 Answers1

0

pyenv installs Python into $PYENV_ROOT, defaults to $HOME/.pyenv, for each user.

When you're using sudo, you switch to root user temporarily in this very command. There's no python installed by pyenv for user root under directory /root/.pyenv. So python version 2.7.9 was not found.

Simba
  • 23,537
  • 7
  • 64
  • 76