pyenv-installer icon indicating copy to clipboard operation
pyenv-installer copied to clipboard

Still see system /usr/bin/python after activation

Open tjyang opened this issue 4 years ago • 3 comments

I am learning pyenv.

After reading existing open/closed issue. I finally got pyenv installed on RockLinux 8.5. But when I try to activate 3.9.8 for log4j project, the which python still return /usr/bin/python.

  • Please advise where I did wrong. from following log
[me@rocky8t01 ~]$ which python
/usr/bin/python
[me@rocky8t01 ~]$ pyenv --version
pyenv 2.2.3
[me@rocky8t01 ~]$ pyenv activate log4j
pyenv-virtualenv: prompt changing will be removed from future release. configure `export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
(log4j) [me@rocky8t01 ~]$ which python
/usr/bin/python
(log4j) [me@rocky8t01 ~]$ pyenv versions
  system
  3.9.8
  3.9.8/envs/log4j
* log4j (set by PYENV_VERSION environment variable)
(log4j) [me@rocky8t01 ~]$ /usr/bin/python -V
Python 3.6.8
(log4j) [me@rocky8t01 ~]$ echo $PATH
/home/me/.pyenv/bin:/home/me/.cargo/bin:/home/me/.local/bin:/home/me/bin:/usr/share/Modules/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin
(log4j) [me@rocky8t01 ~]$

  • Not sure why activate didn't insert "/home/me/.pyenv/versions/3.9.8/bin/" path into $PATH variable ?
(log4j) [me@rocky8t01 ~]$ export PATH=/home/me/.pyenv/versions/3.9.8/bin:$PATH
(log4j) [me@rocky8t01 ~]$ which python
~/.pyenv/versions/3.9.8/bin/python
(log4j) [me@rocky8t01 ~]$

tjyang avatar Dec 26 '21 16:12 tjyang

I have the same issue, but on MacOS 12.0.1.

Solved with adding /.pyenv/shims to PATH (not only /.pyenv/bin). This doc about shims helped me.

export PATH="$HOME/.pyenv/shims:$HOME/.pyenv/bin:$PATH"

nvo87 avatar Jan 07 '22 15:01 nvo87

I have the same issue, but on MacOS 12.0.1.

Solved with adding /.pyenv/shims to PATH (not only /.pyenv/bin). This doc about shims helped me.

export PATH="$HOME/.pyenv/shims:$HOME/.pyenv/bin:$PATH"

Thanks! That solved my issue on Arch Linux!

yenaras avatar Feb 01 '22 01:02 yenaras

Thanks - I had the same issue on Ubuntu 20.04 and the solution above worked.

bentoner avatar Feb 14 '22 06:02 bentoner