Rocky Linux 8
Sponsored Link

Python 3.9 : インストール2021/08/02

 
Python 3.9 をインストールします。
[1] AppStream からインストール可能です。
[root@dlp ~]#
dnf module -y install python39

Dependencies resolved.
==========================================================================================
 Package                     Arch    Version                              Repo        Size
==========================================================================================
Installing group/module packages:
 python39                    x86_64  3.9.2-1.module+el8.4.0+574+843c4898  appstream   31 k
Installing dependencies:
 python39-libs               x86_64  3.9.2-1.module+el8.4.0+574+843c4898  appstream  8.1 M
 python39-pip-wheel          noarch  20.2.4-3.module+el8.4.0+574+843c4898 appstream  1.3 M
 python39-setuptools-wheel   noarch  50.3.2-3.module+el8.4.0+574+843c4898 appstream  496 k
Installing weak dependencies:
 python39-pip                noarch  20.2.4-3.module+el8.4.0+574+843c4898 appstream  2.0 M
 python39-setuptools         noarch  50.3.2-3.module+el8.4.0+574+843c4898 appstream  870 k
Installing module profiles:
 python39/common
Enabling module streams:
 python39                            3.9

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

[root@dlp ~]#
python3 -V

Python 3.9.2

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

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

[root@dlp ~]#
python3 python3_test.py

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


There are 3 programs which provide 'python3'.

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

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

[root@dlp ~]#
python3 -V

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


There are 5 programs which provide 'python'.

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

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

[root@dlp ~]#
python -V

Python 3.9.2
関連コンテンツ