Skip to content
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

pyenv dos not work #400

Closed
MonkeyInWind opened this issue Aug 4, 2021 · 3 comments
Closed

pyenv dos not work #400

MonkeyInWind opened this issue Aug 4, 2021 · 3 comments

Comments

@MonkeyInWind
Copy link

➜  Public pyenv versions
* system (set by /home/pi/.pyenv/version)
  3.9.6
➜  Public pyenv virtualenv 3.9.6 py396
Looking in links: /tmp/tmph3f6ru1q
Requirement already satisfied: setuptools in /home/pi/.pyenv/versions/3.9.6/envs/py396/lib/python3.9/site-packages (56.0.0)
Requirement already satisfied: pip in /home/pi/.pyenv/versions/3.9.6/envs/py396/lib/python3.9/site-packages (21.1.3)
➜  Public pyenv versions
* system (set by /home/pi/.pyenv/version)
  3.9.6
  3.9.6/envs/py396
  py396
➜  Public python --version
Python 2.7.16
➜  Public pyenv activate py396
pyenv-virtualenv: prompt changing will be removed from future release. configure `export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
(py396) ➜  Public pyenv --version
pyenv 2.0.4
(py396) ➜  Public python --version
Python 2.7.16
(py396) ➜  Public python3 --version
Python 3.7.3
(py396) ➜  Public pyenv deactivate
➜  Public python --version
Python 2.7.16

.zshrc

export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
@changtingQ
Copy link

i also find the issue, i can't slove it.

@unoxxis
Copy link

unoxxis commented Aug 8, 2021

I had that too and it is related to zsh's behaviour. You need to rehash after you activate a virtual environment in zsh. See pyenv/pyenv#31 (comment)

If you want to rehash automatically in zsh, either use zstyle ':completion:*' rehash true in your .zshrc (see ohmyzsh/ohmyzsh#3440) or include a shell function for pyenv in your zshrc that passes all arguments to pyenv and afterwards calls rehash (see top answer in https://stackoverflow.com/questions/34340575/zsh-alias-with-parameter).

@MonkeyInWind
Copy link
Author

I had that too and it is related to zsh's behaviour. You need to rehash after you activate a virtual environment in zsh. See pyenv/pyenv#31 (comment)

If you want to rehash automatically in zsh, either use zstyle ':completion:*' rehash true in your .zshrc (see ohmyzsh/ohmyzsh#3440) or include a shell function for pyenv in your zshrc that passes all arguments to pyenv and afterwards calls rehash (see top answer in https://stackoverflow.com/questions/34340575/zsh-alias-with-parameter).

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants