CentOS 6
Sponsored Link

Python 3.5 インストール2017/09/23

 
CentOS 6 標準の Python のバージョンは 2.6系ですが、3.5系を RPM パッケージでインストールします。
[1] CentOS SCLo Software Collections からインストール可能です。
なお、デフォルトバージョンの 2.6系がインストールされた状態でも、Software Collections パッケージは別パスにインスールされるため、複数バージョンの共存が可能となっています。
# SCLoからインストール

[root@dlp ~]#
yum --enablerepo=centos-sclo-rh -y install rh-python35
[2] Software Collections パッケージは /opt 配下にインストールされます。
環境変数を読み込んで利用するには以下のように実行します。
# 環境変数を読み込む

[root@dlp ~]#
scl enable rh-python35 bash
[root@dlp ~]#
python -V

Python 3.5.1
[root@dlp ~]#
which python

/opt/rh/rh-python35/root/usr/bin/python
[3] ログイン時に自動的に有効にするには以下のように設定します。
[root@dlp ~]#
vi /etc/profile.d/python35.sh
# 以下の内容で新規作成

#!/bin/bash

source /opt/rh/rh-python35/enable
export X_SCLS="`scl enable rh-python35 'echo $X_SCLS'`"
関連コンテンツ