AlmaLinux9 python2.xをインストールする手順

環境
AlmaLinux release 9.2 (Turquoise Kodkod)

操作手順
1.gccライブラリをインストールする

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# dnf install gcc
# dnf install gcc
# dnf install gcc

2.現状のpythonのバージョンを確認する

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# python -V
Python 3.9.16
# python -V Python 3.9.16
# python -V
Python 3.9.16

3.圧縮ファイルをダウンロードする

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# cd /usr/local
# wget https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tgz
# cd /usr/local # wget https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tgz
# cd /usr/local
# wget https://www.python.org/ftp/python/2.7.18/Python-2.7.18.tgz

4.ファイルを展開する

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# tar xvf Python-2.7.18.tgz
# tar xvf Python-2.7.18.tgz
# tar xvf Python-2.7.18.tgz

5.展開ディレクトリを作業ディレクトリとする
# cd Python-2.7.18

5.インストールする場所を指定する

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# ./configure --prefix=/usr/local/python2
# ./configure --prefix=/usr/local/python2
# ./configure --prefix=/usr/local/python2

6.インストールを実行する

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# make
# make install
# make # make install
# make
# make install

7.シンボリックリンクを作成する

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# rm -f /usr/bin/python
# ln -s /usr/local/python2/bin/python /usr/bin/python
# python -V
Python 2.7.18
# rm -f /usr/bin/python # ln -s /usr/local/python2/bin/python /usr/bin/python # python -V Python 2.7.18
# rm -f /usr/bin/python
# ln -s /usr/local/python2/bin/python /usr/bin/python
# python -V
Python 2.7.18

 

AlmaLinux 9

Posted by arkgame