【Raspberry Pi】pipをインストールする方法

説明

Raspberry Pi 4に、pipをインストールする方法を解説します。

実例

aptコマンドにて、Raspberry Pi4にpipをインストールする方法を解説します。

動作環境

ubuntu@ubuntu:~$ uname -a
Linux ubuntu 5.4.0-1038-raspi #41-Ubuntu SMP PREEMPT Thu Jun 17 14:14:11 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux
ubuntu@ubuntu:~$ cat /etc/os-release 
NAME="Ubuntu"
VERSION="20.04.2 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.2 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

pipをインストールする方法

aptコマンドにて、Raspberry Pi4にpipをインストールする方法です。

sudo apt install python3-pip

実行例です。

ubuntu@ubuntu:~$ sudo apt install python3-pip
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています                
状態情報を読み取っています... 完了
以下の追加パッケージがインストールされます:
  libexpat1-dev libpython3-dev libpython3.8-dev python-pip-whl python3-dev
  python3-wheel python3.8-dev
以下のパッケージが新たにインストールされます:
  libexpat1-dev libpython3-dev libpython3.8-dev python-pip-whl python3-dev
  python3-pip python3-wheel python3.8-dev
アップグレード: 0 個、新規インストール: 8 個、削除: 0 個、保留: 0 個。
6,438 kB のアーカイブを取得する必要があります。
この操作後に追加で 22.9 MB のディスク容量が消費されます。
続行しますか? [Y/n] Y
取得:1 http://ports.ubuntu.com/ubuntu-ports focal/main arm64 libexpat1-dev arm64 2.2.9-1build1 [103 kB]
取得:2 http://ports.ubuntu.com/ubuntu-ports focal-updates/main arm64 libpython3.8-dev arm64 3.8.10-0ubuntu1~20.04 [3,755 kB]
取得:3 http://ports.ubuntu.com/ubuntu-ports focal/main arm64 libpython3-dev arm64 3.8.2-0ubuntu2 [7,236 B]
取得:4 http://ports.ubuntu.com/ubuntu-ports focal-updates/universe arm64 python-pip-whl all 20.0.2-5ubuntu1.5 [1,805 kB]
取得:5 http://ports.ubuntu.com/ubuntu-ports focal-updates/main arm64 python3.8-dev arm64 3.8.10-0ubuntu1~20.04 [511 kB]
取得:6 http://ports.ubuntu.com/ubuntu-ports focal/main arm64 python3-dev arm64 3.8.2-0ubuntu2 [1,212 B]
取得:7 http://ports.ubuntu.com/ubuntu-ports focal/universe arm64 python3-wheel all 0.34.2-1 [23.8 kB]
取得:8 http://ports.ubuntu.com/ubuntu-ports focal-updates/universe arm64 python3-pip all 20.0.2-5ubuntu1.5 [230 kB]
6,438 kB を 2秒 で取得しました (2,576 kB/s)
以前に未選択のパッケージ libexpat1-dev:arm64 を選択しています。
(データベースを読み込んでいます ... 現在 217135 個のファイルとディレクトリがイン
ストールされています。)
.../0-libexpat1-dev_2.2.9-1build1_arm64.deb を展開する準備をしています ...
libexpat1-dev:arm64 (2.2.9-1build1) を展開しています...
以前に未選択のパッケージ libpython3.8-dev:arm64 を選択しています。
.../1-libpython3.8-dev_3.8.10-0ubuntu1~20.04_arm64.deb を展開する準備をしていま
す ...
libpython3.8-dev:arm64 (3.8.10-0ubuntu1~20.04) を展開しています...
以前に未選択のパッケージ libpython3-dev:arm64 を選択しています。
.../2-libpython3-dev_3.8.2-0ubuntu2_arm64.deb を展開する準備をしています ...
libpython3-dev:arm64 (3.8.2-0ubuntu2) を展開しています...
以前に未選択のパッケージ python-pip-whl を選択しています。
.../3-python-pip-whl_20.0.2-5ubuntu1.5_all.deb を展開する準備をしています ...
python-pip-whl (20.0.2-5ubuntu1.5) を展開しています...
以前に未選択のパッケージ python3.8-dev を選択しています。
.../4-python3.8-dev_3.8.10-0ubuntu1~20.04_arm64.deb を展開する準備をしています .
..
python3.8-dev (3.8.10-0ubuntu1~20.04) を展開しています...
以前に未選択のパッケージ python3-dev を選択しています。
.../5-python3-dev_3.8.2-0ubuntu2_arm64.deb を展開する準備をしています ...
python3-dev (3.8.2-0ubuntu2) を展開しています...
以前に未選択のパッケージ python3-wheel を選択しています。
.../6-python3-wheel_0.34.2-1_all.deb を展開する準備をしています ...
python3-wheel (0.34.2-1) を展開しています...
以前に未選択のパッケージ python3-pip を選択しています。
.../7-python3-pip_20.0.2-5ubuntu1.5_all.deb を展開する準備をしています ...
python3-pip (20.0.2-5ubuntu1.5) を展開しています...
python3-wheel (0.34.2-1) を設定しています ...
libexpat1-dev:arm64 (2.2.9-1build1) を設定しています ...
libpython3.8-dev:arm64 (3.8.10-0ubuntu1~20.04) を設定しています ...
python3.8-dev (3.8.10-0ubuntu1~20.04) を設定しています ...
python-pip-whl (20.0.2-5ubuntu1.5) を設定しています ...
libpython3-dev:arm64 (3.8.2-0ubuntu2) を設定しています ...
python3-dev (3.8.2-0ubuntu2) を設定しています ...
python3-pip (20.0.2-5ubuntu1.5) を設定しています ...
man-db (2.9.1-1) のトリガを処理しています ...
doc-base (0.10.9) のトリガを処理しています ...
doc-base ファイルを 1 個追加 を処理中...
ubuntu@ubuntu:~$

確認コマンドは下記です。

pip -V

実行例です。

ubuntu@ubuntu:~$ pip -V
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
ubuntu@ubuntu:~$ pip3 -V
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)

環境構築する場合に必要となるので覚えておくと便利ですね。

ここまで読んでいただきありがとうございました。

シェアする

  • このエントリーをはてなブックマークに追加

フォローする

スポンサーリンク