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

asdfでWSL+Ubuntuにpythonをインストール

Posted at

はじめに

以前インストールしたプログラミング言語管理ツールのasdfを使って、WSL Ubuntuにpythonをインストールします。

(目的は、DockerCompose + Django環境を構築するにあたり、pythonやpipをいじるためです。)

asdf更新

asdfを更新します。

Ubuntu
asdf update

pythonの存在確認

Ubuntu
asdf plugin list all | grep -e python
# python                        https://github.com/danhper/asdf-python.git

asdfにpythonを追加

Ubuntu
asdf plugin add python

依存パッケージをインストール

GithubのREADMEに従い依存パッケージをインストールします。(Ubuntu/Debian/Mint:の箇所です)

Ubuntu
sudo apt install build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev curl libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev

最新版pythonをインストール

Ubuntu
asdf install python latest

最新版pythonをグローバルに設定

Ubuntu
asdf global python latest

pythonバージョン確認

Ubuntu
asdf current python
# python          3.12.2          /home/[user]/.tool-versions

python -V
# Python 3.12.2

pip -V
# pip 24.0 from /home/[user]/.asdf/installs/python/3.12.2/lib/python3.12/site-packages/pip (python 3.12)
1
1
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
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?