.zshenv
referring to hereConfirm that it is specified in 3.8.6 in pyenv.
% pyenv versions
system
* 3.8.6 (set by /Users/user/.pyenv/version)
However, when I actually checked the version of python, it was not 3.8.6! !!
% python3 -V
Python 3.9.0
% python -V
Python 2.7.16
If you check your PATH in the first place
% echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/user/.pyenv/bin
First comes / user / local / bin
!
% which python
/usr/bin/python
% which python3
/usr/local/bin/python3
I see, pyenv is not used.
~ / .zshenv
looks like this
% cat ~/.zshenv
export PYENV_ROOT=$HOME/.pyenv
export PATH=$PYENV_ROOT/bin:$PATH
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
There seems to be no problem in terms of content.
When it comes to rewriting the order of PATH, is it around / etc / zprofile
?
% cat /etc/zprofile
# System-wide profile for interactive zsh(1) login shells.
# Setup user specific overrides for this in ~/.zprofile. See zshbuiltins(1)
# and zshoptions(1) for more details.
if [ -x /usr/libexec/path_helper ]; then
eval `/usr/libexec/path_helper -s`
fi
I doubt that it is necessary to rewrite such a place, so check the [official site] of pyenv (https://github.com/pyenv/pyenv#homebrew-on-macos).
Then, to ~ / .zshrc
~/.zshrc
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
Immediately move the part described in ~ / .zshenv
to ~ / .zshrc
and restart the terminal!
Then
% echo $PATH
/Users/user/.pyenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/user/.pyenv/bin
% python -V
Python 3.8.6
% which python
/Users/ham/.pyenv/shims/python
--In the case of zsh, not all environment variables should be described in ~ / .zshenv
, and ~ / .zshrc
is also used.
--Check the official documentation.
Recommended Posts