Sunday, October 30, 2016

Install Python 3.4 on Centos 6.8

This will help to install python 3 (multiple version) on Centos
as you know, Centos by default has python 2 installed, if you need to run python 3 then this step is for you

Requirements

openssl-devel is required by pip to be installed, run this code to install openssl-devel
yum install gcc openssl-devel

Installation

I recommend to go to /usr/src folder to download and extract the source, you can choose other directory
cd /usr/src
wget https://www.python.org/ftp/python/3.4.4/Python-3.4.4.tgz
tar xzf Python-3.4.4.tgz

go inside to configure and install from python source
cd Python-3.4.4
./configure
make altinstall
make altinstall is used to prevent replacing the default python binary file /usr/bin/python.

additionally you need to check PATH and export if necessary, check it with
echo $PATH
if result is does not contain /usr/local/bin
export PATH=$PATH:/usr/local/bin

Test

you can test it by activating python version query
# python3.4 -V
Python 3.4.4

and don't forget to check the pip too
# pip3.4 -V
pip 7.1.2 from /usr/local/lib/python3.4/site-packages (python 3.4)

No comments :

Post a Comment