0
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のバージョン管理をanyenvからasdfに変える手順

Posted at

こんにちは。
先日Pythonのバージョン管理をanyenvからasdfに変えたので手順を書いておきます。
メモレベルですが、書き残しておくとどなたかの役に立つかと思いブログにしました。

本記事執筆時の環境

  • Amazon Linux 2023

anyenvの削除

anyenvとasdfが同居してるとどうなるか読めないので削除しておきます。
まず、anyenvからpyenvを削除します。

anyenv uninstall pyenv

次にanyenvをディレクトリごと削除します。

rm -rf .anyenv

初期化ファイルのどこかにパスを通す記述があるはずなのでこれを削除します。
私の場合は、.bash_profileに記載していたのでこれらを削除します。

vi ~/.bash_profile

この2行を削除します。

export PATH="$HOME/.anyenv/bin:$PATH"
eval "$(anyenv init -)"

asdfのインストール

公式ページの手順に従います。

本記事ではAmazon Linux 2023で検証しているので、Homebrew・Pacmanは使用できません。
公式ダウンロードを実行します。


git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.14.0

3. asdfのインストールのBash&Gitに倣って設定~/.bashrcを編集
編集後、source ~/.bashrcで変更した設定をロードいます。

Pythonの準備

asdfにPython追加します。

asdf plugin add python

あとは、asdfでPythonをインストールしていきます。

asdf install python 3.11.6
asdl local python 3.11.6

以上で完了です。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?