Issue
If I've used pyenv to change my Python version, I'd like to have the pip
command be aware of this.
As is, it isn't.
Below, I've run pyenv activate py-3.8.6
. I'm using Python 3.8.6.
(py-3.8.6) macbookpro13@Mys-MacBook-Pro ~ % which pip
/Users/macbookpro13/Library/Python/2.7/bin/pip
(py-3.8.6) macbookpro13@Mys-MacBook-Pro ~ % pyenv which pip
/Users/macbookpro13/.pyenv/versions/py-3.8.6/bin/pip
(py-3.8.6) macbookpro13@Mys-MacBook-Pro ~ %
But the pip command still runs the default system pip, which means anything installed won't be available to pyenv's managed Python.
How to fix?
Solution
I was able to fix this by moving
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
if which pyenv-virtualenv-init > /dev/null; then eval "$(pyenv virtualenv-in it -)"; fi
.. lower in my .zshrc
file. Something else was updating the pip path link.
Answered By - Union find Answer Checked By - Marie Seifert (WPSolving Admin)