2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【python】macで環境構築

Posted at

環境構築

最近pythonの勉強を始めました。こちらのサイトを参考に環境構築を行いました。

pyenvのインストール

Homebrewはインストール済みなので、Pythonのバージョン管理ツールであるpyenvをダウンロードしていきます。

brew install pyenv

正常に処理が終了したらインストールされたか確認

pyenv -v

次にpyenvの初期設定を行う

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

また環境構築の際にいつもなんとなく使用していた.zshrcについてはこちらの記事で理解を深めました。

Pyrhonのインストール

まずインストール可能なPythonのバージョンを確認する。

pyenv install --list

かなりの数が出てきますが、公式サイトを見ながら新しいバージョンをインストールしました。

pyenv install 3.13.0

インストールできたか確認

pyenv versions

この状態だとmacにすでにインストールされていた古いバージョンを使用してしまうので、下記コマンドを実行

pyenv global 3.13.0

一度ターミナルを開き直してから新しいバージョンで切り替わったことを確認

python -version

以上でmacでの環境構築は完了です。windowsでも環境構築をしてみましたが、windowsの方が楽でした。。。

2
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
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?