0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

asdf の使用メモ [Ubuntu18.04]

Last updated at Posted at 2022-04-11

概要

Qiita の「質問」を見ている中で、asdf というツールが存在するようだったので使用してみた.

本記事はその記録である.

 

asdf とは

asdf is a CLI tool that can manage multiple language runtime versions on a per-project basis. It is like gvm, nvm, rbenv & pyenv (and more) all in one! Simply install your language's plugin!
https://github.com/asdf-vm/asdf#asdf--

asdfはrubyやnodeなどの各種プログラミング言語に加え、kubectlやterraformなどの多種多様なツールのバージョン管理を行うことができるCLIツールです。
https://dev.icare.jpn.com/dev_cat/how_to_use_asdf/

実行環境

環境は次の通り

Ubuntu 18.04 
bash

 

インストール

公式手順だと asdf_version が無い、とか色々と環境変数の有効化に失敗したので、公式手順では無い手順で実施した.

asdf を使って Python 3.10.4 を導入してみる

1. 最新を取得する

$ git clone https://github.com/asdf-vm/asdf.git ~/.asdf

2. 環境変数を有効化する

$ source ~/.asdf/asdf.sh

 

3. python 用プラグインを追加する

$ asdf plugin-add python
initializing plugin repository...Cloning into '/home/foo/.asdf/repository'...
remote: Enumerating objects: 3796, done.
remote: Counting objects: 100% (990/990), done.
remote: Compressing objects: 100% (510/510), done.
remote: Total 3796 (delta 587), reused 855 (delta 475), pack-reused 2806
Receiving objects: 100% (3796/3796), 875.58 KiB | 11.67 MiB/s, done.
Resolving deltas: 100% (1950/1950), done.

 

4. python 3.10.4 は導入可能か調べる

$ asdf list-all python |grep -w 10
:
3.10.4
:

 

5. Python 3.10.4 をインストールする

$ asdf install python 3.10.4
python-build 3.10.4 /home/foo/.asdf/installs/python/3.10.4
Downloading Python-3.10.4.tar.xz...
-> https://www.python.org/ftp/python/3.10.4/Python-3.10.4.tar.xz
Installing Python-3.10.4...
WARNING: The Python bz2 extension was not compiled. Missing the bzip2 lib?
Installed Python-3.10.4 to /home/foo/.asdf/installs/python/3.10.4

 

6. Python 3.10.4 を有効にする

$ asdf global python 3.10.4
$ python --version
Python 3.10.4
$ asdf current python
python          3.10.4          /home/foo/.tool-versions

 

その他

asdf で有効化した Python 3.10.4 を使わないようにする方法 ... 不明

正式手順不明.

とりあえず $PATH から $HOME/.asdf 関連を消して再設定すれば良いだろう.

参考にした情報

URL
http://asdf-vm.com/guide/getting-started.html
https://qiita.com/kikuchi_kentaro/items/d951fa7ca7c9c29a77dc
https://qiita.com/dhirabayashi/items/24cb4881ceef0e37d346
https://qiita.com/salty-byte/items/e6fe2bbc748dff15de34#fnref1
https://zenn.dev/noraworld/articles/replace-anyenv-with-asdf
0
1
2

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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?