Note that I installed Python on my Mac
pyenv is a tool that "manages multiple versions of Python". For the time being, you should put it in.
Install with homebrew
brew install pyenv
If the version is displayed below, it means that it has been installed.
pyenv -v
I'm using zsh, so I set the following.
.zshrc settings
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
export PATH="$HOME/.pyenv/shims:$PATH"
eval "$(pyenv init -)"
Reflect the settings
source .zshrc
As mentioned at the beginning, pyenv allows you to use multiple versions of Python. What version of Python can be installed Try running the following command in a terminal.
pyenv install --list
In my case in the above list, 3.9.0 seems to be the latest, so I will install it.
pyenv install 3.9.0
Let's check below to see if it was installed.
pyenv versions
[~/work] % pyenv versions
* system
3.9.0 (set by /Users/XXXXX/.pyenv/version)
In the above, because of the system, we are using the version of Python that is installed by default on the Mac. Let's change it.
pyevn global 3.9.0
Finally, confirm that it has been changed to 3.9.0 properly and it is completed.
python --version
Recommended Posts