Thursday, September 27, 2018

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

Requirement

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
wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tar.xz
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
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=http://www-proxy.us.test.com:80/
pip install oci 
see more details Oracle OCI SDK doc 

Output

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

Error

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:

Post a Comment