高木のブログ

Mac に Homebrew で pyenv をインストールする

· 68 words · 1 minutes to read
Tags: Python pyenv

Mac にデフォルトで入っている Python が古かったので、pyenv で最新バージョンを入れることにした

$ python -V
Python 2.7.16
$ which python
/usr/bin/python

$ python3 -V
Python 3.7.9
$ which python3
/usr/local/bin/python3

手順 🔗

pyenv のインストール 🔗

$ brew install pyenv

$ pyenv -v
pyenv 2.3.15

pyenv のセットアップ 🔗

.zshrc に以下の内容を追記

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
$ source ~/.zshrc

Python のインストール 🔗

最新バージョンの Python をインストールして、デフォルトに設定

$ pyenv install 3.11.2
$ pyenv global 3.11.2

$ python -V
Python 3.11.2

Categories


Tags