0
0

macでのpyenvインストール

Posted at

概要

本記事では、macでのPyenvインストールから、Pythonのインストールまで行う

pyenvのインストール

~ % brew install pyenv
==> Downloading https://ghcr.io/v2/homebrew/core/pyenv/manifests/2.4.8
######################################################################### 100.0%
==> Fetching pyenv
==> Downloading https://ghcr.io/v2/homebrew/core/pyenv/blobs/sha256:45459a58894d
######################################################################### 100.0%
==> Pouring pyenv--2.4.8.arm64_sonoma.bottle.tar.gz
🍺  /opt/homebrew/Cellar/pyenv/2.4.8: 1,215 files, 3.5MB
==> Running `brew cleanup pyenv`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

使用しているシェルの確認

~ % echo $SHELL
/bin/zsh

パスを通す

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

インストール可能なpythonのバージョン確認

~ % pyenv install -list
Available versions:
  2.1.3
  ...バージョン一覧...
  3.12.3
  3.12.4
  ...バージョン一覧...  

pythonのインストール

~ % pyenv install 3.12.3
python-build: use openssl@3 from homebrew
python-build: use readline from homebrew
Downloading Python-3.12.3.tar.xz...
-> https://www.python.org/ftp/python/3.12.3/Python-3.12.3.tar.xz
Installing Python-3.12.3...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
Installed Python-3.12.3 to /path/to/.pyenv/versions/3.12.3

pyenvバージョン確認

~ % pyenv --version
pyenv 2.4.8

pyenvをリフレッシュする

pyenv rehash
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0