Ubuntu20に最新のPython3.11をインストール

私が使っているUbuntu20のサーバーのPython3のバージョンは以下が表示される。記事を書いている時の最新は3.11なのでバージョンアップの手順をまとめておく

server:~$ python3 -V
Python 3.8.10

標準のaptリポジトリーから試してみる

server:~$ sudo apt install python3.11
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package python3.11
E: Couldn't find any package by glob 'python3.11'

だめみたい。検索して良さそうなリポジトリを登録した

server:~$ sudo add-apt-repository ppa:deadsnakes/ppa 
server:~$ sudo apt update

実際にインストール

server:~$ sudo apt install python3.11
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libfwupdplugin1 libxmlb1
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libpython3.11-minimal libpython3.11-stdlib python3.11-minimal
Suggested packages:
  python3.11-venv binfmt-support
The following NEW packages will be installed:
  libpython3.11-minimal libpython3.11-stdlib python3.11 python3.11-minimal
0 upgraded, 4 newly installed, 0 to remove and 61 not upgraded.
Need to get 5,567 kB of archives.
After this operation, 21.9 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal/main amd64 libpython3.11-minimal amd64 3.11.4-1+focal1 [851 kB]
Get:2 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal/main amd64 python3.11-minimal amd64 3.11.4-1+focal1 [2,298 kB]
Get:3 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal/main amd64 libpython3.11-stdlib amd64 3.11.4-1+focal1 [1,801 kB]                                            
Get:4 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu focal/main amd64 python3.11 amd64 3.11.4-1+focal1 [617 kB]                                                        
Fetched 5,567 kB in 49s (114 kB/s)                                                                                                                                     
Selecting previously unselected package libpython3.11-minimal:amd64.
(Reading database ... 120729 files and directories currently installed.)
Preparing to unpack .../libpython3.11-minimal_3.11.4-1+focal1_amd64.deb ...
Unpacking libpython3.11-minimal:amd64 (3.11.4-1+focal1) ...
Selecting previously unselected package python3.11-minimal.
Preparing to unpack .../python3.11-minimal_3.11.4-1+focal1_amd64.deb ...
Unpacking python3.11-minimal (3.11.4-1+focal1) ...
Selecting previously unselected package libpython3.11-stdlib:amd64.
Preparing to unpack .../libpython3.11-stdlib_3.11.4-1+focal1_amd64.deb ...
Unpacking libpython3.11-stdlib:amd64 (3.11.4-1+focal1) ...
Selecting previously unselected package python3.11.
Preparing to unpack .../python3.11_3.11.4-1+focal1_amd64.deb ...
Unpacking python3.11 (3.11.4-1+focal1) ...
Setting up libpython3.11-minimal:amd64 (3.11.4-1+focal1) ...
Setting up python3.11-minimal (3.11.4-1+focal1) ...
Setting up libpython3.11-stdlib:amd64 (3.11.4-1+focal1) ...
Setting up python3.11 (3.11.4-1+focal1) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for mime-support (3.64ubuntu1) ...

成功した模様 実際に使う場合はバージョン指定をする

server:~$ python3 -V
Python 3.8.10

server:~$ python3.11 -V
Python 3.11.4

以上

投稿を作成しました 112

コメントを残す

関連する投稿

検索語を上に入力し、 Enter キーを押して検索します。キャンセルするには ESC を押してください。

トップに戻る
%d人のブロガーが「いいね」をつけました。