Thursday, September 27, 2018

How To Install Python3 and OCI SDK In Different Location of Linux


Default Oracle Linux has python2 installed, right rising of python3, we would like to use python3 for new projects while no touching on existing python2 environment
Get  source cod from python official website
Put it to local /u02/storage

Install Extra,Configure and Make the binaries

Run as root
make -o /u01/python3
cd /u02/storage
tar xf Python-3.6.6.tar.xz
cd Python-3.6.6
yum install openssl-devel
yum install zlib-devel     ---- install zlib to avoid error 
./configure --prefix=/u01/python3
make install
alias pip='/u01/python3/bin/pip3'
alias python='/u01/python3/bin/python3'

Install and Config OCI SDK for Python

If your hosts are behind firewall, you need to tell python proxy details:
export https_proxy=
pip install oci 
see more details Oracle OCI SDK doc 


the successful output is like:
Collecting setuptools
Collecting pip
Installing collected packages: setuptools, pip
Successfully installed pip-10.0.1 setuptools-39.0.1


If you see such error
zipimport.ZipImportError: can't decompress data; zlib not available python
yum install zlib-devel    -------- to fix the zlib missing error

No comments: