Ubuntu 21.10にpython、pipをインストールする

OSバージョンの確認

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=21.10
DISTRIB_CODENAME=impish
DISTRIB_DESCRIPTION="Ubuntu 21.10"
# cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=21.10 DISTRIB_CODENAME=impish DISTRIB_DESCRIPTION="Ubuntu 21.10"
# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=21.10
DISTRIB_CODENAME=impish
DISTRIB_DESCRIPTION="Ubuntu 21.10"

1.パッケージのアップデート
# sudo apt update

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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# sudo apt install build-essential libbz2-dev libdb-dev
build-essential (12.9ubuntu2) を設定しています ...
libc-bin (2.34-0ubuntu3) のトリガを処理しています ...
man-db (2.9.4-2) のトリガを処理しています ...
install-info (6.7.0.dfsg.2-6) のトリガを処理しています ...
# sudo apt install build-essential libbz2-dev libdb-dev 略 build-essential (12.9ubuntu2) を設定しています ... libc-bin (2.34-0ubuntu3) のトリガを処理しています ... man-db (2.9.4-2) のトリガを処理しています ... install-info (6.7.0.dfsg.2-6) のトリガを処理しています ...
# sudo apt install build-essential libbz2-dev libdb-dev
略
build-essential (12.9ubuntu2) を設定しています ...
libc-bin (2.34-0ubuntu3) のトリガを処理しています ...
man-db (2.9.4-2) のトリガを処理しています ...
install-info (6.7.0.dfsg.2-6) のトリガを処理しています ...

2.Pythonをインストール
# sudo apt -y upgrade

pythonのバージョンを確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# python3 -V
Python 3.9.7
# python3 -V Python 3.9.7
# python3 -V
Python 3.9.7

3.実行確認
# python3 -V

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
Python 3.9.7
root@ubuntu:~# python3
Python 3.9.7 (default, Sep 10 2021, 14:59:43)
[GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print('study skill')
study skill
>>>
>>> exit()
Python 3.9.7 root@ubuntu:~# python3 Python 3.9.7 (default, Sep 10 2021, 14:59:43) [GCC 11.2.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> print('study skill') study skill >>> >>> exit()
Python 3.9.7
root@ubuntu:~# python3
Python 3.9.7 (default, Sep 10 2021, 14:59:43)
[GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> print('study skill')
study skill
>>>
>>> exit()

4.pip3をインストール
# sudo apt install -y python3-pip
pip3バージョンを確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# pip3 -V
pip 20.3.4 from /usr/lib/python3/dist-packages/pip (python 3.9)
# pip3 -V pip 20.3.4 from /usr/lib/python3/dist-packages/pip (python 3.9)
# pip3 -V
pip 20.3.4 from /usr/lib/python3/dist-packages/pip (python 3.9)

 

Ubuntu 21.10

Posted by arkgame