×

How to Install Python 3.6 in Cent OS on GCP

To summarise, we have installed & setup the Python 3.6 in CentOS on GCP. Also, a face recognition module has been installed to enable facial recognition command which will retrieve from the dlib & OpenCV libraries.

How to Install Python 3.6 in Cent OS on GCP

The article below comprises the steps of setting up Python 3.6 on CentOS in the Google Cloud Platform(GCP). We would also see how to enable the facial recognition feature using deployment libraries like dlib & OpenCV.They are used to identify facial landmarks like a nose, mouth, eyes, etc.


Installing Python 3.6 & face_recognition & dlib


The steps below demonstrate the installation of the Software Collections or SCL where various versions of software can be installed without affecting the default software package.


  1. yum install centos-release-scl

           

  1. yum update

           

  1. yum install rh-python36

           

  1. python --version

o/p :Python 2.7.5

  1. scl enable rh-python36 bash

  2. python --version

o/p: Python 3.6.3



Install PIP

Here we install pip which is used to manage & download Python packages derived from Python package indexes.

  1. wget https://bootstrap.pypa.io/get-pip.py

            

  1. python get-pip.py




Python CentOS7 build Dlib+OpenCV


The following steps are the installation of the prerequisites for the dlib library,i.e cmake, boost, boost.python etc.

  1. yum install cmake

  2. yum install python-devel numpy

  3. yum install gcc gcc-c++

  4. yum install gtk2-devel

  5. yum install libdc1394-devel

  6. yum install libv4l-devel

  7. yum install ffmpeg-devel

  8. yum install gstreamer-plugins-base-devel

  9. yum install libpng-devel

  10. yum install libjpeg-turbo-devel

  11. yum install jasper-devel

  12. yum install openexr-devel

  13. yum install libtiff-devel

  14. yum install libwebp-devel

  15. yum install opencv

  16. yum install opencv-python

  17. yum install opencv-devel

  18. yum install devtoolset-3-gcc devtoolset-3-binutils devtoolset-3-gcc-c++


Configuring the environment variables


  1. export CC=/opt/rh/devtoolset-3/root/usr/bin/gcc  

  2. export CPP=/opt/rh/devtoolset-3/root/usr/bin/cpp

  3. export CXX=/opt/rh/devtoolset-3/root/usr/bin/c++


Softlinking the installed directory to local/bin


  1. ln -s /opt/rh/devtoolset-3/root/usr/bin/* /usr/local/bin/

  2. hash -r         



Install boost


  1. yum install boost  

           

  1. yum install boost-devel  

            

  1. yum install boost-doc


Install dlib,imutils & face_recognition


  1. pip3 install dlib

  2. pip3 install imutils

  3. pip3 install face_recognition.




Trendy