When I write pyenv
It says
Command 'pyenv' not found, did you mean:
command 'p7env' from deb libnss3-tools
Try: sudo apt install <deb name>
I know this is very common and it is something with the path. I have tried everything in all different files such as bashrc, bash_profile, zshrc etc. What I currently have is in my "bashrc" file:
export PATH="~/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
When I write bash
and then reload the terminal it works, but I cannot change the python version.
I am using a Linux Debian distribution and pyenv version 1.2.27
2
Answers
Bash sources
~/.bashrc
only for interactive non-login shells. So, in an interactive login shell, before you typebash
to open an interactive non-login shell, your~/.bashrc
file will not have been sourced yet. You can fix this by adding the following to your~/.bash_profile
file:For me, it worked like that (in the end of .bashrc):