Python 2.7 : インストール2021/08/02 |
Python 2.7 をインストールします。
|
|
[1] | AppStream からインストール可能です。 |
[root@dlp ~]# dnf module -y install python27 Dependencies resolved. ========================================================================================== Package Arch Version Repo Size ========================================================================================== Installing group/module packages: python2 x86_64 2.7.18-4.module+el8.4.0+403+9ae17a31 appstream 108 k python2-libs x86_64 2.7.18-4.module+el8.4.0+403+9ae17a31 appstream 6.0 M python2-pip noarch 9.0.3-18.module+el8.4.0+403+9ae17a31 appstream 1.7 M python2-setuptools noarch 39.0.1-13.module+el8.4.0+403+9ae17a31 appstream 641 k Installing dependencies: python2-pip-wheel noarch 9.0.3-18.module+el8.4.0+403+9ae17a31 appstream 1.0 M python2-setuptools-wheel noarch 39.0.1-13.module+el8.4.0+403+9ae17a31 appstream 286 k Installing module profiles: python27/common Enabling module streams: python27 2.7 Transaction Summary ========================================================================================== Install 6 Packages ..... .....[root@dlp ~]# python2 -V Python 2.7.18 # テストスクリプトを作成して動作確認 [root@dlp ~]# echo -e "import sys\nprint(sys.version)" > python2_test.py [root@dlp ~]# python2 python2_test.py 2.7.18 (default, May 30 2021, 19:42:58) [GCC 8.4.1 20200928 (Red Hat 8.4.1-1)] |
[2] | バージョン番号を付けない [python] コマンドで使用したい場合は [alternatives] で切り替え可能です。 |
[root@dlp ~]# alternatives --config python
There are 3 programs which provide 'python'.
Selection Command
-----------------------------------------------
*+ 1 /usr/libexec/no-python
2 /usr/bin/python3
3 /usr/bin/python2
Enter to keep the current selection[+], or type selection number: 3
[root@dlp ~]# python -V Python 2.7.18 |
Sponsored Link |
|