1
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?

fishでpythonのバージョンとパッケージ管理をしたい

Posted at

数年前にMac環境でpythonをインストールをしたもののバージョンも古くなってきたので更新がてら手順を保存

環境

今回は開発端末なのでMac環境で実行

❯ sw_vers
ProductName:            macOS
ProductVersion:         15.2
BuildVersion:           24C101

実行手順

Pyenvのインストール

まず Home Brewをアップデートする。

brew update

homebrewからpyenvをインストール

最新の手順は公式リポジトリのREADMEに載っているので以下を参照

brew install pyenv

今回は最新にしたかったので3.13系の最新をインストール

pyenv install python 3.13.1

fishにパスを追加する。

set -Ux PYENV_ROOT $HOME/.pyenv
fish_add_path $PYENV_ROOT/bin
pyenv init - fish | source

pythonのバージョンが上がっていればOK
image.png

venvの設定

pythonコマンドでvenvを設定

python -m venv ./.venv

作成されたvenv配下のactivate.fishコマンドを実行

source ./.venv/bin/activate.fish

こんな感じになっていればOK

image.png

所感

~envみたいなのが乱立していてメンテもしてないので諸々見直してみようかなと思った。

1
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
1
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?