CentOS 7
Ads

Install Python 3.5
2016/07/07
 
The version of Python in CentOS 7 repository is 2.7 but Install 3.5 with RPM package if you need.
[1] It's possible to install from CentOS SCLo Software Collections.
It's OK to install it even if 2.7 is already installed because 3.5 is located on another PATH.
# install from SCLo

[root@dlp ~]#
yum --enablerepo=centos-sclo-rh -y install rh-python35
[2] Packages from Software Collections are installed uder the /opt directory.
To use it, Load environment variables like follows.
# load environment variables

[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] If you'd like to enable 3.5 automatically at login time, configure like follows.
[root@dlp ~]#
vi /etc/profile.d/python35.sh
# create new

#!/bin/bash

source /opt/rh/rh-python35/enable
export X_SCLS="`scl enable rh-python35 'echo $X_SCLS'`"
 
Tweet