Rocky Linux 8
Sponsored Link

Python 3.8 : インストール
2021/08/02
 
Python 3.8 をインストールします。
[1] AppStream からインストール可能です。
[root@dlp ~]#
dnf module -y install python38

Dependencies resolved.
==========================================================================================
 Package                     Arch    Version                              Repo        Size
==========================================================================================
Installing group/module packages:
 python38                    x86_64  3.8.6-3.module+el8.4.0+595+c96abaa2  appstream   78 k
Installing dependencies:
 python38-libs               x86_64  3.8.6-3.module+el8.4.0+595+c96abaa2  appstream  8.3 M
 python38-pip-wheel          noarch  19.3.1-1.module+el8.4.0+570+c2eaf144 appstream  1.2 M
 python38-setuptools-wheel   noarch  41.6.0-4.module+el8.4.0+570+c2eaf144 appstream  303 k
Installing weak dependencies:
 python38-pip                noarch  19.3.1-1.module+el8.4.0+570+c2eaf144 appstream  1.9 M
 python38-setuptools         noarch  41.6.0-4.module+el8.4.0+570+c2eaf144 appstream  666 k
Installing module profiles:
 python38/common
Enabling module streams:
 python38                            3.8

Transaction Summary
==========================================================================================
Install  6 Packages
.....
.....

[root@dlp ~]#
python3 -V

Python 3.8.6

# テストスクリプトを作成して動作確認

[root@dlp ~]#
echo -e "import sys\nprint(sys.version)" > python3_test.py

[root@dlp ~]#
python3 python3_test.py

3.8.6 (default, Jun 29 2021, 21:14:45)
[GCC 8.4.1 20200928 (Red Hat 8.4.1-1)]
[2] 複数バージョンの Python3 をインストールしている場合は [alternatives] で切り替え可能です。
[root@dlp ~]#
alternatives --config python3


There are 2 programs which provide 'python3'.

  Selection    Command
-----------------------------------------------
*+ 1           /usr/bin/python3.6
   2           /usr/bin/python3.8

Enter to keep the current selection[+], or type selection number: 2

[root@dlp ~]#
python3 -V

Python 3.8.6
[3] バージョン番号を付けない [python] コマンドで使用したい場合は [alternatives] で切り替え可能です。
[root@dlp ~]#
alternatives --config python


There are 4 programs which provide 'python'.

  Selection    Command
-----------------------------------------------
*+ 1           /usr/libexec/no-python
   2           /usr/bin/python3
   3           /usr/bin/python2
   4           /usr/bin/python3.8

Enter to keep the current selection[+], or type selection number: 4

[root@dlp ~]#
python -V

Python 3.8.6
関連コンテンツ