Rocky Linux 8にpython 3.10.1をインストールする

環境
# cat /etc/redhat-release
Rocky Linux release 8.5 (Green Obsidian)

インストールの方法
1.ダウンロードの先を作成します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# sudo mkdir -p /opt/python
# cd /opt/python
# sudo mkdir -p /opt/python # cd /opt/python
# sudo mkdir -p /opt/python
# cd /opt/python

2.python 3.10.1をダウンロードします

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# VERSION=3.10.1
# wget https://www.python.org/ftp/python/${VERSION}/Python-${VERSION}.tgz
ファイルを解凍します
# tar -xf Python-${VERSION}.tgz
# cd Python-${VERSION}
# VERSION=3.10.1 # wget https://www.python.org/ftp/python/${VERSION}/Python-${VERSION}.tgz ファイルを解凍します # tar -xf Python-${VERSION}.tgz # cd Python-${VERSION}
# VERSION=3.10.1
# wget https://www.python.org/ftp/python/${VERSION}/Python-${VERSION}.tgz

ファイルを解凍します
# tar -xf Python-${VERSION}.tgz
# cd Python-${VERSION}

3.pythonをインストールします
環境の最適化を行います

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# ./configure --enable-optimizations
config.status: creating pyconfig.h
creating Modules/Setup.local
creating Makefile
# ./configure --enable-optimizations 略 config.status: creating pyconfig.h creating Modules/Setup.local creating Makefile
# ./configure --enable-optimizations
略
config.status: creating pyconfig.h
creating Modules/Setup.local
creating Makefile

コア数を確認します
# nproc
1

pythonファイルをビルドします

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# sudo make -j 1
# sudo make -j 1
# sudo make -j 1

pythonをインストールします

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# sudo make -j 1
make[1]: ディレクトリ '/opt/python/Python-3.10.1' から出ます
# sudo make -j 1 略 make[1]: ディレクトリ '/opt/python/Python-3.10.1' から出ます
# sudo make -j 1
略
make[1]: ディレクトリ '/opt/python/Python-3.10.1' から出ます

# sudo make altinstall

4.バージョンを確認します
# python3.10 –version
Python 3.10.1

Rocky Linux 8

Posted by arkgame