Python 2.7 : インストール2021/03/15 |
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+668+03e3490a appstream 109 k python2-libs x86_64 2.7.18-4.module_el8.4.0+668+03e3490a appstream 6.0 M python2-pip noarch 9.0.3-18.module_el8.4.0+642+1dc4fb01 appstream 1.7 M python2-setuptools noarch 39.0.1-13.module_el8.4.0+642+1dc4fb01 appstream 642 k Installing dependencies: python2-pip-wheel noarch 9.0.3-18.module_el8.4.0+642+1dc4fb01 appstream 1.0 M python2-setuptools-wheel noarch 39.0.1-13.module_el8.4.0+642+1dc4fb01 appstream 287 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, Jan 29 2021, 18:19:04) [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 |
|